How long does it take for this sequence to obtain this loop? For positive integers $m,n$, define a sequence $S_m(n)$ so that $S_m(1)=m$, $S_m(n+1)=S_m(n)^2-1$ if $S_m(n)$ is prime, and $S_m(n+1)$ is the greatest prime factor of $S_m(n)$ otherwise. It is clear that, regardless of $m$, this sequence always gets caught in the infinite loop $2,3,8,2,3,\dots$, because for any prime $p$, $p^2-1=(p+1)(p-1)$ and if $p\neq 2$ then the greatest prime factor of this term is at most $\lceil p/2\rceil<p$. 
What is less clear, is the rate at which the sequence becomes stuck into that loop. If we define $t(m)$ to be the smallest integer $n$ so that $S_m(n)=2$, then how does $t(m)$ grow? By some numerical testing I've found that $t(m)<20$ for all $m<10000$, which seems to suggest a logarithmic growth speed. In particular, for any positive integer $N$, is it always true that there exists an $m$ so that $t(m)>N$? Any thoughts are appreciated!
 A: Recording the following observation to get the ball rolling.
Assume that $\ell>2$ is a Sophie Germain prime, in other words, a prime such that $p=2\ell+1$ is also a prime. In that case
$$
(p+1)(p-1)=(2\ell+2)\cdot2\ell=2^3\cdot\frac{\ell+1}2\ell
$$
implying that $\ell$ is the largest prime factor of $p^2-1$. So if $S_m(n)=p$ then $S_m(n+2)=\ell$.
A Cunningham chain of length $k$ is a sequence of iterated Sophie Germain primes
$$p_1<p_2<p_3<\cdots<p_k$$
such that $p_{i+1}=2p_i+1$ for all $i$. For example, $5<11<23<47$ is Cunningham sequence of length $4$. Iterating the argument of the previous paragraph tells us that if $S_m(n)=p_k$ for some $m,n$, then $S_m(n+2(k-1))=p_1$. This implies that if a Cunngham chain of length $k$ exists, then it takes about $2k$ steps for your sequence to come down to $p_1$.
According to the cited Wikipedia page it is an open conjucture that arbitrarily long Cunningham chains exist. In light of the above that conjecture would imply that the function $t$ is unbounded.

Of course, there is no need to have longer and longer Cunningham chains for $t$ to be unbounded. I just felt that this connection may be interesting. It is, of course, easy to show that the set of prime factors of numbers of the form $p^2-1$ is unbounded, but I couldn't see how unboundedness of $t$ would follow from such a simple fact.
