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-8 of 8 results.

A155043 a(0)=0; for n >= 1, a(n) = 1 + a(n-d(n)), where d(n) is the number of divisors of n (A000005).

Original entry on oeis.org

0, 1, 1, 2, 2, 3, 2, 4, 3, 3, 3, 4, 3, 5, 4, 5, 5, 6, 4, 7, 5, 7, 5, 8, 6, 6, 6, 9, 6, 10, 6, 11, 7, 11, 7, 12, 10, 13, 8, 13, 8, 14, 8, 15, 9, 14, 9, 15, 9, 10, 10, 16, 10, 17, 10, 17, 10, 18, 11, 19, 10, 20, 12, 19, 19, 21, 12, 22, 13, 22, 13, 23, 11, 24, 14, 23, 14, 25, 14, 26, 14, 15, 15
Offset: 0

Views

Author

Ctibor O. Zizka, Jan 19 2009

Keywords

Comments

From Antti Karttunen, Sep 23 2015: (Start)
Number of steps needed to reach zero when starting from k = n and repeatedly applying the map that replaces k by k - d(k), where d(k) is the number of divisors of k (A000005).
The original name was: a(n) = 1 + a(n-sigma_0(n)), a(0)=0, sigma_0(n) number of divisors of n.
(End)

Crossrefs

Sum of A262676 and A262677.
Cf. A261089 (positions of records, i.e., the first occurrence of n), A262503 (the last occurrence), A262505 (their difference), A263082.
Cf. A262518, A262519 (bisections, compare their scatter plots), A262521 (where the latter is less than the former).
Cf. A261085 (computed for primes), A261088 (for squares).
Cf. A262507 (number of times n occurs in total), A262508 (values occurring only once), A262509 (their indices).
Cf. A263265 (nonnegative integers arranged by the magnitude of a(n)).
Cf. also A004001, A005185.
Cf. A264893 (first differences), A264898 (where repeating values occur).

Programs

  • Haskell
    import Data.List (genericIndex)
    a155043 n = genericIndex a155043_list n
    a155043_list = 0 : map ((+ 1) . a155043) a049820_list
    -- Reinhard Zumkeller, Nov 27 2015
    
  • Maple
    with(numtheory): a := proc (n) if n = 0 then 0 else 1+a(n-tau(n)) end if end proc: seq(a(n), n = 0 .. 90); # Emeric Deutsch, Jan 26 2009
  • Mathematica
    a[0] = 0; a[n_] := a[n] = 1 + a[n - DivisorSigma[0, n]]; Table[a@n, {n, 0, 82}] (* Michael De Vlieger, Sep 24 2015 *)
  • PARI
    uplim = 110880; \\ = A002182(30).
    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]);
    for(n=0, uplim, write("b155043.txt", n, " ", A155043(n)));
    \\ Antti Karttunen, Sep 23 2015
    
  • Python
    from sympy import divisor_count as d
    def a(n): return 0 if n==0 else 1 + a(n - d(n))
    print([a(n) for n in range(101)]) # Indranil Ghosh, Jun 03 2017
  • Scheme
    (definec (A155043 n) (if (zero? n) n (+ 1 (A155043 (A049820 n)))))
    ;; Antti Karttunen, Sep 23 2015
    

Formula

From Antti Karttunen, Sep 23 2015 & Nov 26 2015: (Start)
a(0) = 0; for n >= 1, a(n) = 1 + a(A049820(n)).
a(n) = A262676(n) + A262677(n). - Oct 03 2015.
Other identities. For all n >= 0:
a(A259934(n)) = a(A261089(n)) = a(A262503(n)) = n. [The sequence works as a left inverse for sequences A259934, A261089 and A262503.]
a(n) = A262904(n) + A263254(n).
a(n) = A263270(A263266(n)).
A263265(a(n), A263259(n)) = n.
(End)

Extensions

Extended by Emeric Deutsch, Jan 26 2009
Name edited by Antti Karttunen, Sep 23 2015

A261089 a(n) = least k such that A155043(k) = n; positions of records in A155043.

Original entry on oeis.org

0, 1, 3, 5, 7, 13, 17, 19, 23, 27, 29, 31, 35, 37, 41, 43, 51, 53, 57, 59, 61, 65, 67, 71, 73, 77, 79, 143, 149, 151, 155, 157, 161, 163, 173, 177, 179, 181, 185, 191, 193, 199, 203, 209, 211, 215, 219, 223, 231, 233, 237, 239, 241, 249, 251, 263, 267, 269, 271, 277, 285, 291, 293, 299, 303, 315, 317, 321, 327, 331, 335, 337, 341, 347, 349, 357, 359, 369, 515
Offset: 0

Views

Author

Antti Karttunen, Sep 23 2015

Keywords

Comments

Note that there are even terms besides 0, and they all seem to be squares: a(915) = 7744 (= 88^2), a(41844) = 611524 (= 782^2), a(58264) = 872356 (= 934^2), a(66936) = 1020100 (= 1010^2), a(95309) = 1503076 (= 1226^2), a(105456) = 1653796 (= 1286^2), ...

Crossrefs

Cf. A262503 (the last occurrence of n in A155043).
Cf. A262505 (difference between the last and the first occurrence).
Cf. A262507 (the number of occurrences of n in A155043).
Cf also A261085, A261088.

Programs

  • Haskell
    import Data.List (elemIndex); import Data.Maybe (fromJust)
    a261089 = fromJust . (`elemIndex` a155043_list)
    -- Reinhard Zumkeller, Nov 27 2015
  • Mathematica
    lim = 80; a[0] = 0; a[n_] := a[n] = 1 + a[n - DivisorSigma[0, n]]; t = Table[a@ n, {n, 0, 12 lim}]; Table[First@ Flatten@ Position[t, n] - 1, {n, 0, lim}] (* Michael De Vlieger, Sep 29 2015 *)
  • PARI
    allocatemem(123456789);
    uplim = 2162160; \\ = A002182(41).
    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; k=0; while(k <= 10000, if(A155043(n)==k, write("b261089.txt", k, " ", n); k++); n++;);
    
  • Scheme
    ;; With Antti Karttunen's IntSeq-library, two variants.
    (definec (A261089 n) (let loop ((k 0)) (if (= n (A155043 k)) k (loop (+ 1 k)))))
    (define A261089 (RECORD-POS 0 0 A155043))
    

Formula

Other identities. For all n >= 0:
A155043(a(n)) = n.

A262680 Number of squares encountered before zero is reached when iterating A049820 starting from n: a(0) = 0 and for n >= 1, a(n) = A010052(n) + a(A049820(n)).

Original entry on oeis.org

0, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 0, 1, 0, 1, 2, 1, 0, 1, 0, 1, 0, 1, 2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1
Offset: 0

Views

Author

Antti Karttunen, Oct 03 2015

Keywords

Comments

Number of perfect squares (A000290) encountered before zero is reached when starting from k = n and repeatedly applying the map that replaces k by k - d(k), where d(k) is the number of divisors of k (A000005). This count includes n itself if it is a square, but excludes the final zero.
Also number of times the parity (of numbers encountered) changes until zero is reached when iterating A049820. This count includes also the last parity change 1 - d(1) -> 0 if coming to zero through 1.
There is a lower bound for this sequence that grows without limit if and only if either (1) A259934 is indeed the unique sequence (satisfying its given condition) and it contains an infinite number of squares (see A262514), or (2) more generally, if each one of all (hypothetically multiple) infinite branches of the tree (defined by parent-child relation A049820(child) = parent) contains an infinite number of squares. See also comments in A262509.

Examples

			For n=1, we subtract 1 - A000005(1) = 0, thus we reach zero in one step, and the starting value 1 is a square, thus a(1) = 1. Also, the parity changes once, from odd to even as we go from 1 to 0.
For n=24, when we start repeatedly subtracting the number of divisors (A000005), we obtain the following numbers: 24 - A000005(24) = 24 - 8 = 16, 16 - A000005(16) = 16 - 5 = 11, 11 - 2 = 9, 9 - 3 = 6, 6 - 4 = 2, 2 - 2 = 0. Of these numbers, 16 and 9 are squares larger than zero, thus a(24)=2. Also, we see that the parity changes twice: from even to odd at 16 and then back from odd to even at 9.
		

Crossrefs

Bisections: A262681, A262682.
Cf. A262687 (positions of records).

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

A263087 a(n) = A060990(n^2); number of solutions to x - d(x) = n^2, where d(x) is the number of divisors of x (A000005).

Original entry on oeis.org

2, 2, 1, 1, 1, 0, 0, 0, 0, 2, 0, 1, 2, 1, 0, 1, 0, 1, 0, 1, 0, 2, 0, 1, 2, 1, 0, 0, 0, 1, 1, 2, 1, 1, 0, 0, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 2, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 2, 3, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0
Offset: 0

Views

Author

Antti Karttunen, Oct 12 2015

Keywords

Crossrefs

Cf. A263093 (positions of zeros), A263092 (nonzeros).
Cf. A263250, A263251 (bisections) and A263252, A263253 (their partial sums).
Cf. also A261088, A263088.

Programs

  • PARI
    A060990(n) = { my(k = n + 2400, s=0); while(k > n, if(((k-numdiv(k)) == n),s++); k--;); s}; \\ Hard limit A002183(77)=2400 good for at least up to A002182(77) = 10475665200.
    A263087(n) = A060990(n^2);
    for(n=0, 10082, write("b263087.txt", n, " ", A263087(n)));
    
  • Scheme
    (define (A263087 n) (A060990 (A000290 n)))

Formula

a(n) = A060990(n^2) = A060990(A000290(n)).

A262687 a(n) = index of first n in A262680; positions of records in A262680.

Original entry on oeis.org

0, 1, 4, 169, 324, 1521, 125316, 126025, 425104, 1713481, 1716100, 4959529, 24760576
Offset: 0

Views

Author

Antti Karttunen, Oct 03 2015

Keywords

Comments

All terms are squares (A262688 gives the square roots).
The even and odd terms alternate.

Crossrefs

Cf. A262688 (square roots of these terms).

Programs

  • PARI
    allocatemem((2^31)+(2^30));
    uplim = 2^25;
    v262680 = vector(uplim);
    v262680[1] = 1; v262680[2] = 0;
    for(i=3, uplim, v262680[i] = issquare(i) + v262680[i-numdiv(i)];
    if(!(i%65536),print1(i,", ")););
    A262680 = n -> if(!n,n,v262680[n]);
    n=0; k=0; while(n*n <= uplim, if(A262680(n*n)==k, write("b262687.txt", k, " ", n*n); k++); n++;);
    
  • Scheme
    ;; With Antti Karttunen's IntSeq-library.
    (define A262687 (RECORD-POS 0 0 A262680))

A263088 a(n) = A262697(n^2).

Original entry on oeis.org

0, 6, 2, 38, 2, 1, 1, 1, 1, 22, 1, 0, 0, 2, 1, 3, 1, 9, 1, 39, 1, 47, 1, 51, 4, 114, 1, 1, 1, 529, 2, 6, 2, 3, 1, 1, 22, 1, 11, 3, 2, 4, 7, 93, 7, 967, 1, 1, 3, 4, 1, 3, 2, 4, 1, 3, 1, 3, 1, 1, 1, 2, 1, 139, 2, 265, 2, 1, 6, 464, 12, 4, 22, 1, 2, 1503, 2, 6, 1, 5, 2, 2, 1, 2, 5, 1, 2, 4, 2, 1, 1, 6, 3, 386, 1, 1, 3, 800, 1, 2, 1, 7, 5, 1, 1, 3353, 1, 2, 21, 3, 1, 17, 3, 3, 1, 4, 1, 5, 1, 3, 9, 2
Offset: 0

Views

Author

Antti Karttunen, Oct 12 2015

Keywords

Comments

a(n)=0 if n^2 is in A259934, otherwise number of nodes in that finite subtree whose root is n^2 and edge-relation is defined by A049820(child) = parent. This count includes also leaves and n^2 itself.

Crossrefs

Cf. also A261088, A263087.
Cf. A262515 (positions of zeros), A263093 (positions of ones).

Programs

Formula

a(n) = A262697(A000290(n)) = A262697(n^2).
Other identities. For all n >= 0:
If A263087(n) = 0, a(n) = 1.

A330877 Number of steps needed to reach zero or a cycle when starting from k = n and repeatedly applying the map that replaces k by k - d(k) if k is even, by k + d(k) if k is odd, where d(k) is the number of divisors of k (A000005).

Original entry on oeis.org

0, 2, 1, 7, 3, 6, 2, 5, 4, 4, 3, 12, 3, 11, 4, 10, 13, 10, 4, 9, 5, 8, 5, 8, 14, 7, 6, 32, 6, 32, 6, 31, 7, 30, 7, 29, 33, 29, 8, 28, 8, 28, 8, 27, 9, 26, 9, 12, 9, 11, 10, 25, 10, 25, 10, 24, 10, 23, 11, 23, 10, 22, 12, 21, 24, 21, 12, 21, 13
Offset: 0

Views

Author

Ctibor O. Zizka, Apr 29 2020

Keywords

Comments

First cycle we see for n = 83. The length of the cycle is 38 steps. To reach a cycle means the time to first step into the loop.

Examples

			n = 1, mapping steps are 1 + 1 = 2, 2 - 2 = 0, a(1) = 2;
n = 2, mapping steps are 2 - 2 = 0, a(2) = 1;
n = 3, mapping steps are 3 + 2 = 5, 5 + 2 = 7, 7 + 2 = 9, 9 + 3 = 12, 12 - 6 = 6, 6 - 4 = 2, 2 - 2 = 0, a(3) = 7;
n = 4, mapping steps are 4 - 3 = 1, 1 + 1 = 2, 2 - 2 = 0, a(4) = 3;
n = 5, mapping steps are 5 + 2 = 7, 7 + 2 = 9, 9 + 3 = 12, 12 - 6 = 6, 6 - 4 = 2, 2 - 2 = 0, a(5) = 6.
		

Crossrefs

Showing 1-8 of 8 results.