show this either $m=k^2$ or $m = 5k^2$ for some integer $k$. Let $f(x)$ be the distance from $x$ to the nearest perfect square. For example, $f(\pi) = 4 - \pi$. Let $\alpha = \frac{3 + \sqrt{5}}{2}$ and let $m$ be an integer such that the sequence $a_n = f(m \; \alpha^n)$ is bounded. Prove that either $m=k^2$ or $m = 5k^2$ for some integer $k$.
This problem from:
The 58th IMO in 2017 was loaded into IMO history with its high difficulty and low score. The IMO set a number of records since the restructuring in 1983, including the lowest total score(170 points), the lowest personal score(35 points), and the lowest gold score(25 points). Only 2 of the most difficult 3 questions scored full marks. The total score of 615 players in 111 participating countries worldwide was only 26 points, with an average score of 0.042 points. The top 10 countries scored a total of 6 points on this question.
After the match, a Brazilian player Dave Sena, who won a silver medal with 19 points, proposed the "IMO Revenge" to express his respect for the teachers and his "revenge". He collected questions from IMO players and selected four questions as trial questions. Invite and encourage team leaders, deputy team leaders and observers to participate. As a result, the initiative received a lot of positive response from IMO players and team leaders.
 A: Solutions to this problem are provided in the commented link. This answer is to prove little bit more in the context of Pisot-Vijayaraghavan number. 
The function $f(x)$ can be written as 
$$
f(m\alpha^n)=\min_{z\in\mathbb{Z}}|(z-\sqrt m \beta^n)(z+\sqrt m\beta^n)|$$
$$=\begin{cases} \|\sqrt m \beta^n \| 2\sqrt m \beta^n + O(1) &\mbox{ in all cases,} \\
\| \sqrt m \beta^n\|(\epsilon_{m,n}\|\sqrt m \beta^n\|+2\sqrt m \beta^n) &\mbox{ if $\|\sqrt m \beta^n\|\rightarrow 0$ as $n\rightarrow \infty$} \end{cases}.
$$
where $\beta=\frac{1+\sqrt 5}2$ and $\overline{\beta}=\frac{1-\sqrt 5}2$, $\|x\|$ is the distance from $x$ to the nearest integer to $x$. Here, $\epsilon_{m,n}=\pm 1$. The implied constant in the big-Oh is at most $1/4$. 
For $f(m\alpha^n)$ to be bounded, we must have $\|\sqrt m \beta^n\|\rightarrow 0$ as $n\rightarrow \infty$. This is because $\beta^n\rightarrow\infty$, $\overline{\beta}^n\rightarrow 0$. 
By one of the theorem that wiki link has, we must have $\sqrt m \in \mathbb{Q}(\sqrt 5)$. This holds only when $m=k^2$ or $m=5k^2$. 
Conversely, we assume $m=k^2$ or $m=5k^2$. Then we have
$$
\|\sqrt m \beta^n\|=\sqrt m |\overline{\beta}^n|
$$
since $\sqrt m \beta^n+\sqrt m \overline{\beta}^n \in \mathbb{Z}$ if $m=k^2$, and $\sqrt m \beta^n-\sqrt m \overline{\beta}^n\in\mathbb{Z}$ if $m=5k^2$. 
Now, by $\beta\overline{\beta}=-1$, 
$$
f(m\alpha^n)=\| \sqrt m \beta^n\|(\epsilon_{m,n}\|\sqrt m \beta^n\|+2\sqrt m \beta^n)\rightarrow 2m \ \textrm{as} \ n\rightarrow\infty.
$$
