%I #27 Oct 09 2017 15:26:40
%S 0,0,2,0,1,0,2,5,1,0,4,0,1,1,2,0,2,0,1,1,2,0,1,2,1,3,2,0,1,0,5,1,1,1,
%T 2,0,1,2,1,0,4,0,1,5,1,0,2,4,2,1,1,0,3,1,3,1,1,0,1,0,4,1,2,1,2,0,3,4,
%U 2,0,2,0,1,2,1,4,1,0,2,2,3,0,1,1,1,3,1,0,1,2,1,1,2,3,1,0,3,2,2,0,2,0,2,1,2
%N Number of iterations of f(x) = sigma(x)-1 applied to n required to reach a prime, or -1 if no prime is ever reached.
%H Charles R Greathouse IV, <a href="/A039655/b039655.txt">Table of n, a(n) for n = 2..10000</a>
%H MathOverflow, <a href="http://mathoverflow.net/questions/181019/does-iterating-a-certain-function-related-to-the-sums-of-divisors-eventually-alw">Does iterating a certain function related to the sums of divisors eventually always result in a prime value?</a>, 2014
%H Hugo Pfoertner, <a href="/A039655/a039655.txt">Terms a(2)...a(1000000).</a>
%H N. J. A. Sloane, Three (No, 8) Lovely Problems from the OEIS, Experimental Mathematics Seminar, Rutgers University, Oct 05 2017, <a href="https://vimeo.com/237029685">Part I</a>, <a href="https://vimeo.com/237030304">Part 2</a>, <a href="https://oeis.org/A290447/a290447_slides.pdf">Slides.</a> (Mentions this sequence)
%t f[n_] := Plus @@ Divisors@n - 1; g[n_] := Length@ NestWhileList[ f@# &, n, !PrimeQ@# &] - 1; Table[ g@n, {n, 2, 106}] (* _Robert G. Wilson v_, May 07 2010 *)
%o (PARI) a(n)=my(t);while(!isprime(n),n=sigma(n)-1;t++);t \\ _Charles R Greathouse IV_, Sep 16 2014
%Y Cf. A039654, A039649, A039650, A039651, A039652, A039653, A039655, A039656.
%Y For records see A292114 and A292115.
%K nonn
%O 2,3
%A _David W. Wilson_
%E Escape clause added by _N. J. A. Sloane_, Aug 31 2017
|