I recently came across this problem from [USAMO 2005][1]:

"A calculator is broken so that the only keys that still
work are the $\sin$, $\cos$, $\tan$, $\arcsin$, $\arccos$ and $\arctan$ buttons. The display initially shows $0$. Given any positive rational number $q$, show that
pressing some finite sequence of buttons will yield $q$. Assume that the
calculator does real number calculations with infinite precision. All
functions are in terms of radians."

A surprising question whose ingenious solution actually shows how to generate the square root of any rational number.

I'd like to pose the following question related to this problem:

>**What is the smallest set of continuous real functions which can be applied to $0$ to yield a sequence containing all the rational numbers?**


Note that this is a slightly different question to the one above in that we are asking not only to be able to produce any rational from $0$ but to produce all of them at some point after starting at $0$. In the case of the USAMO question they are equivalent since every function's inverse is again contained in our set so having generated $q$ one can obviously reverse the steps to get back to $0$ and start again.

Note that from the theory of continued fractions of rational numbers the functions $f(x)=1/x$, $g(x)=x+1$ will generate any given rational starting from $0$. For example since

$\frac{355}{113} = 3+\cfrac{1}{7+\cfrac{1}{16}}$

we have $\frac{355}{113}=g^{[3]}(f(g^{[7]}(f(g^{[16]}(0)))))$.

If we also throw in $h(x)=x-1$ we again have every inverse included hence this set of three functions will generate all rationals.

So we know that the smallest set must contain either $1$, $2$ or $3$ functions.

  [1]: https://artofproblemsolving.com/wiki/index.php/1995_USAMO_Problems