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.

Original entry on oeis.org

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, 17, 12, 11, 10, 31, 74, 25, 99, 11
Offset: 1

Views

Author

N. J. A. Sloane, Aug 31 2017

Keywords

Examples

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

Crossrefs

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

Programs

  • Maple
    A291302 := proc(n)
        local a,x ;
        a := 0 ;
        x := mul(ithprime(i),i=1..n) ;
        while not isprime(x) do
            x := numtheory[sigma](x)-1 ;
            a := a+1 ;
        end do:
        a ;
    end proc: # R. J. Mathar, Sep 12 2017
  • Mathematica
    p[n_]:=Times@@Prime/@Range[n];f[n_]:=DivisorSigma[1,n]-1;
    a[n_]:=Length[NestWhileList[f,p[n],CompositeQ]]-1;a/@Range[34] (* Ivan N. Ianakiev, Sep 01 2017 *)
  • Python
    from sympy import primorial, isprime, divisor_sigma
    def A291302(n):
        m, c = primorial(n), 0
        while not isprime(m):
            m = divisor_sigma(m) - 1
            c += 1
        return c # Chai Wah Wu, Aug 31 2017

Extensions

a(11)-a(35) from Chai Wah Wu, Aug 31 2017
a(36)-a(38) from Ivan N. Ianakiev, Sep 01 2017