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.

Showing 1-2 of 2 results.

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

A261087 Primes p for which A155043(p) < A155043(prevprime(p)), where A155043 gives the number of steps needed to reach zero when repeatedly applying the map that replaces k with k - A000005(k).

Original entry on oeis.org

83, 127, 227, 281, 307, 367, 443, 541, 631, 677, 853, 863, 967, 1091, 1217, 1427, 1451, 1487, 1523, 1667, 1787, 1861, 1997, 2027, 2153, 2207, 2297, 2339, 2411, 2477, 2543, 2693, 2711, 2837, 2909, 2963, 3089, 3251, 3313, 3323, 3467, 3533, 3593, 3677, 3719, 3797, 3863, 3917, 3989, 4007, 4019, 4091, 4259, 4447, 4493, 4643, 4657, 4783, 4787, 4799, 4877, 4937, 5087, 5119, 5441
Offset: 1

Views

Author

Antti Karttunen, Sep 23 2015

Keywords

Examples

			A155043(83) = 16 although A155043(79) = 26, thus 83 is included in this sequence.
		

Crossrefs

Programs

Formula

a(n) = A000040(A261086(n)).
Showing 1-2 of 2 results.