Testing integrality of a number Let $x$ be a real number. Show that $x$ is an integer if and only if 
$$[x] + [2x] + \cdots + [nx] = n ([x] + [nx])/2,$$ for all natural numbers $n$.
Can you give me an idea?
 A: Subtracting the equations for $n+1$ and $n$ yields that
$$
\begin{align*}
[(n+1)x]&=\frac{[x]+(n+1)[(n+1)x]-n[nx]}{2}\\
\implies [x]+(n-1)[(n+1)x]&=n[nx]\\
\implies (n-1)\left\{[(n+1)x]-(n+1)[x]\right\}&=n\left\{[nx]-n[x]\right\}\\
\end{align*}
$$
Consequently,
$$
[nx]-n[x]=\frac{n-1}{n-2}\cdot \frac{n-2}{n-3}\cdots \frac{2}{1}([2x]-2[x])=(n-1)([2x]-2[x]).
$$
When $\{x\}<\frac{1}{2}$, the right side vanishes so the left side vanishes, giving $\{x\}<\frac{1}{n}$. As this holds for all $n$, it follows that $\{x\}=0$ and $x$ is an integer in this case.
Lastly if $\{x\}\geq \frac{1}{2}$, then we get $[nx]-n[x]=n-1$, whereupon $\{x\}\geq \frac{n-1}{n}$. But this holds for all $n$, yielding a contradiction (since $\{x\}<1$). Consequently $x$ is an integer.
Moreoever, it is clear the equation holds for all integer values of $x$.
A: HINT: Showing that 
$$\lfloor x\rfloor+\lfloor 2x\rfloor+\ldots+\lfloor nx\rfloor=\frac{n\left(\lfloor x\rfloor+\lfloor nx\rfloor\right)}2\tag{1}$$
whenever $x$ is an integer is very straightforward, and I’ll leave it to you.
Suppose that $x$ is not an integer, let $m=\lfloor x\rfloor$, and let $\alpha=x-m$, so that $0<\alpha<1$. Then
$$\begin{align*}
\lfloor x\rfloor+\lfloor 2x\rfloor+\ldots+\lfloor nx\rfloor&=\sum_{k=1}^n\lfloor kx\rfloor\\
&=\sum_{k=1}^n\lfloor km+k\alpha\rfloor\\
&=\sum_{k=1}^n\left(km+\lfloor k\alpha\rfloor\right)\\
&=m\sum_{k=1}^nk+\sum_{k=1}^n\lfloor k\alpha\rfloor\\
&=\frac{mn(n+1)}2+\sum_{k=1}^n\lfloor k\alpha\rfloor\;,
\end{align*}$$
so you want to prove that there is an $n$ such that
$$\frac{mn(n+1)}2+\sum_{k=1}^n\lfloor k\alpha\rfloor\ne\frac{n\left(\lfloor x\rfloor+\lfloor nx\rfloor\right)}2\;,$$
or, after a bit more simplifying, such that
$$\frac2n\sum_{k=1}^n\lfloor k\alpha\rfloor\ne \lfloor n\alpha\rfloor\;.$$
What happens if $\alpha<\frac12$ and $n$ is the smallest integer greater than or equal to $\frac1\alpha$?
What if $\alpha>\frac12$ and $n$ is the smallest integer greater than or equal to $\frac 1{1-\alpha}$?
What if $\alpha=\frac12$ and $n=3$?
A: Hint: Try to show that for noninteger positive number $x$ the equality does not hold.
For instance, let $x=[x]+\{ x\}$, with $0<\{ x\}<1$ and let $n$ be the smallest natural number
such that $n\{ x\}\geq 1$. Then, for $1\leq k\leq n-1$ one has $[kx]=k[x]$ because of
$kx=k[x]+k\{ x\}$ and $k\{ x\}<1$. For $k=n$ one has $[nx]>n[x]$ since $n\{ x\}\geq 1>\{ nx\}$.
A: If $k\leq x<k+1$ then for $n=3$ we get :
$[x]=k, [2x]=2k$ or $2k+1, [3x]=3k$ or $3k+1$ or $3k+2$
with simple calculate and comparison we have :
$$[x]=k, [2x]=2k, [3x]=3k$$
and for $n\geq 4$, from assumption we get :
$$[nx]=nx$$
therefor $x\in\mathbb{N}$.
A: Take the limit of a constant sequence!
Specifically, start by rewriting the given equation as
$$
\begin{align*}
\frac{\lfloor (n+1)\{x\}\rfloor}{n}&=\frac{\lfloor n\{x\}\rfloor}{n-1}\\
\implies\lfloor 2\{x\}\rfloor&=\lim_{n\to\infty}\frac{\lfloor (n+1)\{x\}\rfloor}{n}\\
&=\{x\}.
\end{align*}
$$
Since $\lfloor 2\{x\}\rfloor$ is an integer, we have shown that $\{x\}$ (and therefore $x$) is an integer.
