TITLE: What are the possible loops when doing this a type of function to the rationals?
QUESTION [5 upvotes]: I have John Hilbert to thank for his wonderful question that made me ask more questions What loops are possible when doing this function to the rationals?.
I thought well why not try instead of $f(\frac{a}{b})=\frac{a+b}{b+1}$ I thought of a general version $f_n(\frac{a}{b})=\frac{a+b}{b+n}$. I started with $\frac{1}{1}$ and found a quick loop $\frac{1}{1},\frac{2}{3}$.
Then I tried a random number $\frac{1}{3}$ and got a series I proved never loops. you can find out for the x$^{th}$ iteration you can write it as $\frac{x^2}{2x+1}=\frac{x}{2} + \frac{1}{(4 (2 x + 1))} - \frac{1}{4}$ and the two values $x^2$ and $2x+1$ are always coprime.
after thinking about it I think that for John's original problem the terms can't go to infinity but that's just a hunch.
My question is for all n greater than 1 a series that never loops. and my question is for $f_n(\frac{a}{b})$ are there only finite examples of loops?

REPLY [2 votes]: This answer partially solves OP's question by showing that iterations of $f_n$ may not loop if $n$ is even.

Let $a, b$ be coprime and write $\mathsf{F}_n(a,b) := (a+b, b+n)$. Then a sufficient condition that $\{f_n^{\circ k}(a/b)\}_{k\geq 0}$ never loops (i.e. not eventually periodic) is that
$$ \gcd(\mathsf{F}_n^{\circ k}(a, b)) = 1 \qquad \text{for all}  \quad k \geq 0. \tag{1} $$
We will focus on the case where $n$ is even, so that $n = 2m$ for some positive integer $m$. Then we note that
$$ \mathsf{F}_n^{\circ k}(a, b) = ( a + bk + mk(k-1), b + 2mk ). $$
Let $d := \gcd(b, n)$. Then $\gcd(a + bk + mk(k-1), d) = 1$. So, if we write $\tilde{b} := d/d$, then
$$ \gcd(\mathsf{F}_n^{\circ k}(a, b)) = \gcd(a + bk + mk(k-1), \tilde{b} + (2m/d)k). $$
We make a further simplification depending on the parity of $b$:

Case 1. Suppose $b$ is odd. Then $d = \gcd(b, m)$ holds and hence $\tilde{m} := m/d$ is an integer. Moreover, $4\tilde{m}$ and $\tilde{b}+2\tilde{m}k$ are always coprime. So
\begin{align*}
\gcd(\mathsf{F}_n^{\circ k}(a, b))
&= \gcd( 4\tilde{m} ( a + bk + mk(k-1) ), \tilde{b} + 2\tilde{m}k) \\
&= \gcd(4\tilde{m}a + 2\tilde{m}b - \tilde{b}b, \tilde{b} + 2\tilde{m}k).
\end{align*}
Note that $g_n(a,b) := 4\tilde{m}a + 2\tilde{m}b - \tilde{b}b = (2na + nb - b^2)/d$ is now a fixed integer.

Case 2. Suppose $b$ is even. Then $d$ is even, and so, $\tilde{m} := n/d = m/(d/2)$ divides $m$. Moreover, $\tilde{m}$ and $\tilde{b}+\tilde{m}k$ are always coprime. So
\begin{align*}
\gcd(\mathsf{F}_n^{\circ k}(a, b))
&= \gcd( a + bk + mk(k-1), \tilde{b} + \tilde{m}k) \\
&= \gcd( \tilde{m} ( a + bk + mk(k-1) ), \tilde{b} + \tilde{m}k) \\
&= \gcd( \tilde{m}a + \tilde{m}b/2 - \tilde{b}b/2, \tilde{b} + \tilde{m}k).
\end{align*}
Similarly as before, $g_n(a,b) := \tilde{m}a + \tilde{m}b/2 - \tilde{b}b/2 = (2na + nb - b^2)/(2d)$ does not depend on $k$.


Summarizing, $\text{(1)}$ is satisfied (so that $\{f_n^{\circ k}(a/b)\}_{k\geq 0}$ never loops) whenever $g_n(a,b)$ is coprime to all of $(b+nk)/d$ for $k \geq 0$.
Here we summarize some examples:

Example 1. $g_2(1,2) = 1$, $g_2(1,3) = 1$, and $g_2(1,4) = -1$ show that none of
$$\{f_2^{\circ k}(1/2)\}_{k\geq 0}, \qquad \{f_2^{\circ k}(1/3)\}_{k\geq 0}, \qquad \text{and} \qquad \{f_2^{\circ k}(1/4)\}_{k\geq 0}$$
become eventually periodic.


Example 2. Still assuming that $n$ is even, we have $g_n(1,n) = 1$. So it follows that
$$\{f_n^{\circ k}(1/n)\}_{k\geq 0} $$
never loops. In fact, this case can be proved much easily by noting that $$ f_n^{\circ k}(1/n) = \frac{1+n\binom{k+1}{2}}{n(k+1)} $$
is always a simplified fraction. So the usefulness of the main observation comes from the fact that it allows to find less trivial examples, for instance by solving the equation $g_n(a,b) = \pm 1$.


When $n$ is odd, various simulations seem to suggest that $f_n$ always fall into a finite cycle. I suspect that modifying this proof might work, although I feel too exhausted to pursue in this direction now.