3. Given a natural number $n$. Determine the number of solutions to the equation

$$
x^{2}-\left[x^{2}\right]=(x-[x])^{2}
$$

for which $1 \leq x \leq n$.
Solution. If we set

$$
x=m+\alpha, m \in\{1,2, \ldots, n-1\}, 0 \leq \alpha<1
$$

the given equation becomes

$$
m^{2}+2 m \alpha=\left[m^{2}+2 m \alpha+\alpha^{2}\right]
$$

According to this, the number $m+\alpha$ is a solution to the given equation if and only if $2 m \alpha$ is an integer, i.e., if and only if

$$
\alpha \in\left\{0, \frac{1}{2 m}, \frac{2}{2 m}, \ldots, \frac{2 m-1}{2 m}\right\}
$$

which means that in the interval $[m \cdot m+1)$ the given equation has $2 m$ solutions. Since $x=n$ is also a solution to the equation, we conclude that the number of solutions to this equation is

$$
1+2(1+2+\ldots+(n-1))=1+n(n-1)=n^{2}-n+1
$$