TITLE: Rational Solutions to $\frac{1}{x} = x - \left \lfloor{x}\right \rfloor$
QUESTION [6 upvotes]: I'm curious about if there are rational solutions to the equation $\frac{1}{x} = x - \left \lfloor{x}\right \rfloor$. The equation has infinitely many solutions,  which I deduce as follows:
1) Note, for $x > 1$, $0 < \frac{1}{x} < 1$
2) Note, for $x>1$, $x - \left \lfloor{x}\right \rfloor$ is periodic with period 1, ranging between 0 and 1
Therefore, there are infinitely many intersects. This can also be easily seen by graphing the LHS and RHS as functions. Furthermore, we note that the solutions only occur when $x > 1$.
However, after examining many of the solutions, I didn't find any rational ones. Letting $x = \frac{p}{q}$, where $p,q \in \mathbb{R}$ and $p > q$ (because $x>1$) we then have:
$\frac{q}{p} = \frac{p}{q} - \left \lfloor{\frac{p}{q}}\right \rfloor$
$\frac{q}{p} = \frac{(p \mod q)}{q}$, which comes from the fact that $\frac{p}{q} - \left \lfloor{\frac{p}{q}}\right \rfloor$ basically eliminates the whole number part of $\frac{p}{q}$, and leaves the fractional part.
$\frac{q^2}{p} = (p \mod q)$
However, at this point, I get stuck. It's evident that $p$ can't be a multiple of $q$ and that $q < p < q^2$. I'm considering currently trying to make some sort of prime factorization argument, but I'm not sure what it would look like. Would appreciate any help!

REPLY [2 votes]: You are on the right track. Continue your argument and you will find the answer.
Let $p=q*n+r $, where $q, n , r \in \mathbb N$. Now we have $\frac{q}{qn+r}=\frac {r}{q}$, and it follows $q^2-r^2=nqr$. Further, $\frac {q}{r}-\frac{r}{q}=n$. Let $\frac {q}{r}=t$ and this leads to a quadric equation w.r.t t, $t^2-tn-1=0$.
Clearly, there is no rational t when $n\in \mathbb N$ since $n^2+4$ can not be a square ($n \neq 0$). In other words, $\frac {q}{r}$ is irrational. This contradicts that $q, r \in \mathbb N$