Finding the values of $x$ such that $[x^2]=[x]^2$ ($[\cdot]$ denotes the floor function)

Write $x=n+r$, where $n\in\mathbb{Z}$ and $0\le r\lt1$. Then we want $$ \left\lfloor n^2+2nr+r^2\right\rfloor=\left\lfloor(n+r)^2\right\rfloor=\lfloor n+r\rfloor^2=n^2\tag1 $$ If $r=0$, then $(1)$ is true. Thus, we have any $x\in\mathbb{Z}$ is a solution.

Now, assume $0\lt r\lt1$. $(1)$ requires $$ 0\le2nr+r^2\lt1\tag2 $$ To satisfy the left-hand inequality of $(2)$, we need $$ 2n+r\ge0\tag3 $$ So we need $n\ge0$. To satisfy the right-hand inequality of $(2)$, we need $$ 0\lt r\lt-n+\sqrt{n^2+1}\tag4 $$ which is equivalent to $$ n\lt x\lt\sqrt{n^2+1}\tag5 $$ Therefore, we get the complete solution set to be $$ x\in\mathbb{Z}\cup\bigcup_{n=0}^\infty\left(n,\sqrt{n^2+1}\right)\tag6 $$


$$0\leq\ 2nr+r^2<1$$

Solve$$ 2nr+r^2-1=0$$ for $r$ in terms of $n$.

$$ r=-n\pm \sqrt {n^2+1} $$

For $$-n- \sqrt {n^2+1} <r< -n+\sqrt {n^2+1}$$

We get $$0\leq\ 2nr+r^2<1$$

Since $r\ge 0$, we just need $$ r< -n+\sqrt {n^2+1}$$

For example if $n=10$, we have to have $r<\sqrt {101}-10 \approx 0.049875$