cp's OEIS Frontend

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.

A291302 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.

This page as a plain text file.
%I A291302 #23 Sep 12 2017 12:30:20
%S A291302 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 A291302 17,12,11,10,31,74,25,99,11
%N A291302 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 A291302 2*3*5*7*11*13 = 30030 -> 96767 -> 111359 -> 117239 takes three steps to reach a prime, so a(6) = 3.
%p A291302 A291302 := proc(n)
%p A291302     local a,x ;
%p A291302     a := 0 ;
%p A291302     x := mul(ithprime(i),i=1..n) ;
%p A291302     while not isprime(x) do
%p A291302         x := numtheory[sigma](x)-1 ;
%p A291302         a := a+1 ;
%p A291302     end do:
%p A291302     a ;
%p A291302 end proc: # _R. J. Mathar_, Sep 12 2017
%t A291302 p[n_]:=Times@@Prime/@Range[n];f[n_]:=DivisorSigma[1,n]-1;
%t A291302 a[n_]:=Length[NestWhileList[f,p[n],CompositeQ]]-1;a/@Range[34] (* _Ivan N. Ianakiev_, Sep 01 2017 *)
%o A291302 (Python)
%o A291302 from sympy import primorial, isprime, divisor_sigma
%o A291302 def A291302(n):
%o A291302     m, c = primorial(n), 0
%o A291302     while not isprime(m):
%o A291302         m = divisor_sigma(m) - 1
%o A291302         c += 1
%o A291302     return c # _Chai Wah Wu_, Aug 31 2017
%Y A291302 Cf. A039654, A039653, A291301 (the prime reached).
%K A291302 nonn,more
%O A291302 1,4
%A A291302 _N. J. A. Sloane_, Aug 31 2017
%E A291302 a(11)-a(35) from _Chai Wah Wu_, Aug 31 2017
%E A291302 a(36)-a(38) from _Ivan N. Ianakiev_, Sep 01 2017