TITLE: Proof or Counterexample for Sequence Convergence Conjecture
QUESTION [6 upvotes]: Recently I came up with a number sequence defined as:
$$
a_{i} = \begin{cases}
N & \text{if } i = 0 \\
S(a_{i-1})  & \text{if } i > 0
\end{cases}
$$
Where:
$$
S(N) = \begin{cases}
\sum \text{Prime Factors of N} & \text{if N is composite} \\
N + P_{next} &\text{if N is prime}
\end{cases}
$$
And $P_{next}$ is defined as the next prime after N. (i.e. If N is 7, $P_{next}$ is 11)  
It can be shown the sequence will loop on:
(N=5): {5, 12, 7, 18, 8, 6, 5, ...}
(N=4): {4, 4, ...}
(N=3): {3, 8, 6, 5, 12, 7, 18, 8, 6, 5, ...}
(N=2): {2, 5, 12, 7, 18, 8, 6, 5, ...}  
For clarity's sake, $\sum \text{Prime Factors of N}$, refers to the summation of ALL prime factors with respect to their multiplicities.
For example: S(18) = 8 because 18 is composite, and its prime factors are {2,3,3}. Since 2 + 3 + 3 = 8, S(18) = 8.
For $N\geq2$ and $N\leq10,000,000$, with the exception of N = 4, all sequences converge on 5, which as shown above is a looping sequence.  
My conjecture is that for all $N\geq2$, with the excepton of N = 4, the sequence will converge to 5.
Is it possible to prove this conjecture? Or conversely, disprove it through a counterexample?
As stated above, I have tested the conjecture for $2\leq N\leq 10,000,000$.
Thanks in advance.

REPLY [2 votes]: Your conjecture is true, and it can be proven with a little number theory and some of the computation that you've already done.
The function that you use in the composite-$N$ case, the sum of all the prime divisors (with multiplicity) of $N$, is sometimes known as the integer log or the potency of $N$; you can find more about it at https://oeis.org/A001414 .  For convenience's sake, I'm going to write this as $\log_{\mathbb N}(n)$ going forwards.
We're going to need to prove a few basic properties of $\log_{\mathbb N}$:

For all $n$, $\log_{\mathbb N}(n)\leq n$.  This can be proven by (strong) induction: if $n$ is prime, then obviously $\log_{\mathbb N}(n)=n\leq n$. Otherwise, let $p$ be the smallest prime factor of $n$; then $\frac np\geq p$, and so $\log_{\mathbb N}(n)=p+\log_{\mathbb N}(\frac np)$ $\leq p+\frac np$ (by the induction step) $\leq \frac np+\frac np$ (since $p\leq\frac np$) $=\frac2pn$ $\leq n$ (since $p\geq 2$).
For all composite $n\gt 4$, $\log_{\mathbb N}(n)\lt n$ (i.e., the inequality is strict). The argument is similar: let $p$ be the smallest prime divisor of $n$ and note that $\log_{\mathbb N}(n)\leq p+\frac np$. But now, if $p=2$ then the right hand side is $2+\frac n2$, and $2+\frac n2\lt n$ for $n\gt 4$, so $\log_{\mathbb N}(n)\lt n$; otherwise (i.e., if $p\gt 2$) we have $\log_{\mathbb N}(n) \leq p+\frac np \leq \frac np+\frac np$ (as above) $=\frac 2pn$ $\lt n$ (since $p\gt 2$).
Finally, one further refinement: for all composite $n\gt 45$, not of the form $n=2p$ for prime $p$, we have $\log_{\mathbb N}(n)\lt \frac25n$.  We argue as before: first, we can find a divisor $d$ of $n$ with $3\leq d\leq\frac nd$. (If $4|n$ then take $d=4$; otherwise, let $d$ be the smallest odd prime divisor of $n$.) But now, if $d=3$ then $\log_{\mathbb N}(n)\leq 3+\frac n3$ $\lt \frac n{15}+\frac n3$ (since $n\gt 45$) $=\frac25n$.  If $d=4$ then $\log_{\mathbb N}(n)\leq 4+\frac n4$ $\lt \frac3{20}n+\frac n4$ (since $n\gt 27$) $=\frac25n$.  If $d=5$ then $\log_{\mathbb N}(n)\leq 5+\frac n5$ $\lt \frac n5+\frac n5$ (since $n\gt 25$) $=\frac25n$.  And finally, if $d\gt 5$ then $\log_{\mathbb N}(n)\leq d+\frac nd\leq \frac nd+\frac nd =\frac 2dn\lt \frac25n$.

Now, we can show that for all $N\gt 45$, we'll have either $S(N)\lt N$ or $S(S(N))\lt N$.  Since this process can be repeated until we get to $N\leq 45$ and we already know that all $N\leq 45$ (except for $4$) go into the $5$-cycle, then this implies that all $N$ will fall into this cycle.  This breaks down into two cases: if $N$ is composite, then we know that $S(N)=\log_{\mathbb N}(N)\lt N$ by the second basic property of $\log_{\mathbb N}$.  Finally, we're left with the case that $N=p$, a prime.
To handle the prime case, note that by simple extensions of Bertrand's Postulate we have that for any constant $\epsilon$ there's an $n_0$ such that for all $p\gt n_0$ the prime after $p$ will always be $\lt (1+\epsilon)p$; this means that for all sufficiently large $p$, $S(p)\lt (2+\epsilon)p$. In particular, it's known that for all $p\gt 25$, $p_{\mathrm{next}}(p)\lt (1+\frac15)p$, so $S(p)=p+p_{\mathrm{next}}(p)\lt \frac{11}{5}p$.
But $S(p)$ will always be composite (it's divisible by $2$, after all!) and it can never be of the form $2q$ for prime $q$ (can you see why?) so for all $p\gt 25$ we have $S(S(p)) \lt \frac25S(p)$ (by the third basic property of $\log_{\mathbb N}$, since $S(p)$ is large enough for that to hold) $\lt \frac25\cdot\frac{11}{5}p$ (by the extended Bertrand's postulate) $=\frac{22}{25}p\lt p$.
Now, knowing that for $N\gt 45$ we always have either $S(N)\lt N$ (if $N$ is composite) or $S(S(N))\lt N$ (if $N$ is prime), we can 'hopscotch' our way downwards to the range that your computer simulations have covered, by taking one or two steps along the path as appropriate. For instance, suppose $N=199$. Since $N$ is prime, we take a 'hop' of two steps: $S(S(199))=S(199+211)=S(410) = 2+5+41 = 48$.  Now 48 is composite, so we take a single step: $S(48) = 2+2+2+2+3=11$. And now this is inside our 'range', so we know it falls into the loop.  This same procedure will work for any $N\gt 45$, eventually carrying us to a number less than $45$ where we're assured of falling into the $5$-cycle.