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.

A261085 Number of steps needed to reach zero when starting from the n-th prime [i.e., setting k to A000040(n)] and repeatedly applying the map that replaces k with k - d(k), where d(k) is the number of divisors of k (A000005).

Original entry on oeis.org

1, 2, 3, 4, 4, 5, 6, 7, 8, 10, 11, 13, 14, 15, 15, 17, 19, 20, 22, 23, 24, 26, 16, 18, 20, 21, 22, 22, 23, 24, 23, 24, 25, 26, 28, 29, 31, 33, 33, 34, 36, 37, 39, 40, 40, 41, 44, 47, 34, 35, 49, 51, 52, 54, 54, 55, 57, 58, 59, 58, 59, 62, 48, 49, 50, 66, 69, 71, 73, 74, 74, 76, 55, 57, 59, 60, 61, 63, 63, 65, 68, 69, 71, 72, 74, 62, 64, 65, 66, 67, 67, 70, 72, 73, 75, 76, 77, 80, 81, 75, 77, 79, 79, 81
Offset: 1

Views

Author

Antti Karttunen, Sep 23 2015

Keywords

Examples

			For n=4 we have prime(4) = 7, from which we start subtracting the number of divisors, to get the following path: 7 - 2 = 5, 5 - 2 = 3, 3 - 2 = 1, 1 - 1 = 0, and we have reached zero in four steps, thus a(4) = 4.
For n=5 we have prime(5) = 11, for which the similar process results: 11 - 2 = 9, 9 - 3 = 6, 6 - 4 = 2, 2 - 2 = 0, and again we have reached zero in four steps, thus also a(5) = 4.
		

Crossrefs

Cf. A261086 (gives the positions of drops, i.e., where nonmonotonic) and A261087 (the corresponding primes).

Programs

  • Mathematica
    mpr[p_]:=Length[NestWhileList[#-DivisorSigma[0,#]&,p,#>0&]]-1; mpr/@Prime[ Range[ 120]] (* Harvey P. Dale, Aug 18 2022 *)
  • PARI
    uplim = 65537;
    v155043 = vector(uplim);
    v155043[1] = 1; v155043[2] = 1;
    for(i=3, uplim, v155043[i] = 1 + v155043[i-numdiv(i)]);
    A155043 = n -> if(!n,n,v155043[n]);
    n=0; forprime(p=2, uplim, n++; write("b261085.txt", n, " ", A155043(p)));
    
  • Scheme
    (define (A261085 n) (A155043 (A000040 n)))

Formula

a(n) = A155043(A000040(n)).