This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A291786 #31 Sep 22 2017 11:59:36 %S A291786 0,0,0,0,0,1,0,0,0,1,0,3,0,2,1,0,0,3,0,2,2,1,0,6,0,1,0,5,0,4,0,0,9,8, %T A291786 7,6,0,5,4,3,0,5,0,2,-1,1,0,-1,0,-1,6,5,0,4,-1,-1,2,1,0,-1,0,4,3,0,3, %U A291786 2,0,-1,-1,-1,0,-1,0 %N A291786 a(n) = number of iterations of k -> (psi(k)+phi(k))/2 (A291784) needed to reach a prime or a power of a prime or 1, or -1 if that doesn't happen. %C A291786 Primes and prime powers are fixed points under the map f(k) = (psi(k)+phi(k))/2, so in that case we take a(n)=0. (If n = p^k, then psi(n) = p^k(1+1/p), phi(n) = p^k(1-1/p), and their average is p^k, so n is a fixed point under the map.) %C A291786 Since f(n)>n if n is not a prime power, there can be no nontrivial cycles. %C A291786 Wall (1985) observes that the trajectories of 45 and 50 are unbounded, so a(45) = a(50) = -1. See A291787, A291788. %D A291786 Richard K. Guy, Unsolved Problems in Number Theory, 3rd Edition, Springer, 2004. See Section B41, p. 147. %H A291786 C. R. Wall, <a href="http://www.jstor.org/stable/2323173">Unbounded sequences of Euler-Dedekind means</a>, Amer. Math. Monthly, 92 (1985), 587. %F A291786 a(n) = 0 iff n is in A000961. - _M. F. Hasler_, Sep 03 2017 %o A291786 (PARI) A291786(n,L=n)=n>1&&for(i=0,L,isprimepower(n)&&return(i);n=A291784(n));-(n>1) \\ The suggested search limit L=n is only empirical and might require revision. The code also currently assumes that the prime powers are the only cycles. - _M. F. Hasler_, Sep 03 2017 %Y A291786 Cf. A000010, A001615, A291784, A291785, A291787, A291788. %K A291786 sign,more %O A291786 1,12 %A A291786 _N. J. A. Sloane_, Sep 02 2017 %E A291786 Initial terms corrected and more terms from _M. F. Hasler_, Sep 03 2017