# 18 positive integers satisfying $(x-a)(x-2a)(x-a^2)<0$ and $a>2$ find natural number a

let $a>2$ be a constant. If there are just 18 positive integers satisfying the inequality $(x-a)(x-2a)(x-a^2)<0$ then find the natural number $a$.

zeroes: $a\ \ \ \ \ \ \ 2a\ \ \ \ \ \ \ a^2$
$\ \ -ve\ \ +ve\ \ \ -ve\ \ \ \ +ve$

Set of solutions:$\{ 3,4,5,\cdots, a-1\}U\{2a+1,2a+2,\cdots,a^2-1\}$

No. of elements =18
$a-3+a^2-2a-1=18$
$a^2-a-22=0$

But this equation has no solution in natural numbers.

What fault have I made in my procedure?

You already wrote that the zeroes are $a$, $2a$ and $a^2$.
Next, you need to check that the equation is true for $x<a$ and for $2a<x<a^2$ since $a$ is a natural number.
Since you only consider positive integers, you also have $x>0$.
There are $a-1$ positive integers between $0$ and $a$, and $a^2-2a-1$ positive integers between $2a$ and $a^2$.
In total, we have $$a^2-2a-1+a-1=a^2-a-2$$ positive integers satisfying your equation. Finally, we solve $a^2-a-2=18$ and find out that $a=5$.