Let $f(x)=\lfloor \frac{k}{x} \rfloor$. Find all positive integers $k$ such that $f(f(x))=x$ has exactly $1$ googol solutions.
I noticed that since $f^2(x)=x$, $f(x)$ must be its own inverse, but I do not see how this is related to the fixed number of solutions as the inverse would be infinitely many solutions. Can anyone help?
I'll define $s(k)$ as $2\lfloor \sqrt{k} \rfloor$ is not a perfect square and $-1 + 2\lfloor \sqrt{k}\rfloor$ otherwise.
$f(f)$ has one googol fixed points if and only if $s(k)$ is a googol.
I'll assume the range of $f$ is $[1, k]$.
For simplicity I'll define $a/b$ as $\left\lfloor \frac{a}{b} \right\rfloor$.
Let's examine the expression $(a/(a/b))$.
I claim $(a/(a/x)) = x$ has $s(a)$ solutions.
First, note that $f$ is order-reversing. If $a \le b$, then $f(b) \le f(a)$.
$f$ also takes a value smaller than the square root of $k$ to one larger than the square root of $k$ and vice versa.
$f$ as a mapping from the larger half to the smaller half is surjective, since each step from $b$ to $b+1$ moves $\frac{a}{b}$ to $\frac{a}{b+1}$, whose difference is less than one.
When $f$ is not a perfect square, we can imagine $f$ as a directed bipartite graph, sending values less than the square root to values greater than the square root and vice versa. Since $f$ is order-reversing, each small value in $[1, \lfloor\sqrt{k}\rfloor]$ is in its own cycle and there are no other cycles. Therefore there are $2\lfloor \sqrt{k} \rfloor$ solutions.
When $k$ is a perfect square, $\sqrt{k}$ forms a self-loop.
Therefore there are $s(k)$ solutions.