login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

a(n) = number of steps to reach a prime when x -> sigma(x)-1 is repeatedly applied to the product of the first n primes, or -1 if no prime is ever reached.
5

%I #23 Sep 12 2017 12:30:20

%S 0,1,1,2,1,3,3,1,3,4,46,57,7,9,17,1,45,1,33,8,10,4,3,32,6,47,17,21,41,

%T 17,12,11,10,31,74,25,99,11

%N a(n) = number of steps to reach a prime when x -> sigma(x)-1 is repeatedly applied to the product of the first n primes, or -1 if no prime is ever reached.

%e 2*3*5*7*11*13 = 30030 -> 96767 -> 111359 -> 117239 takes three steps to reach a prime, so a(6) = 3.

%p A291302 := proc(n)

%p local a,x ;

%p a := 0 ;

%p x := mul(ithprime(i),i=1..n) ;

%p while not isprime(x) do

%p x := numtheory[sigma](x)-1 ;

%p a := a+1 ;

%p end do:

%p a ;

%p end proc: # _R. J. Mathar_, Sep 12 2017

%t p[n_]:=Times@@Prime/@Range[n];f[n_]:=DivisorSigma[1,n]-1;

%t a[n_]:=Length[NestWhileList[f,p[n],CompositeQ]]-1;a/@Range[34] (* _Ivan N. Ianakiev_, Sep 01 2017 *)

%o (Python)

%o from sympy import primorial, isprime, divisor_sigma

%o def A291302(n):

%o m, c = primorial(n), 0

%o while not isprime(m):

%o m = divisor_sigma(m) - 1

%o c += 1

%o return c # _Chai Wah Wu_, Aug 31 2017

%Y Cf. A039654, A039653, A291301 (the prime reached).

%K nonn,more

%O 1,4

%A _N. J. A. Sloane_, Aug 31 2017

%E a(11)-a(35) from _Chai Wah Wu_, Aug 31 2017

%E a(36)-a(38) from _Ivan N. Ianakiev_, Sep 01 2017