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.

A366912 Partial sums of A366911: a(1) = 0, and for n > 0, a(n+1) = a(n) + A366911(n).

This page as a plain text file.
%I A366912 #10 Oct 27 2023 22:19:20
%S A366912 0,1,2,3,2,3,2,3,4,5,4,5,4,5,4,5,4,5,4,5,4,5,6,5,6,5,6,7,8,5,7,5,6,5,
%T A366912 6,5,7,6,7,6,7,6,7,6,7,6,7,6,7,6,7,6,7,6,7,6,7,6,7,6,7,6,7,6,7,6,7,6,
%U A366912 7,6,7,6,7,6,7,6,7,6,7,8,6,7,8,9,8,9,8
%N A366912 Partial sums of A366911: a(1) = 0, and for n > 0, a(n+1) = a(n) + A366911(n).
%C A366912 By analogy with A064289, a(n) corresponds to the height of A364054(n) = number of addition steps - number of subtraction steps to produce it.
%H A366912 Rémy Sigrist, <a href="/A366912/a366912.png">Colored scatterplot of the first 100000 terms of A364054</a> (where the color is function of a(n))
%H A366912 Rémy Sigrist, <a href="/A366912/a366912.gp.txt">PARI program</a>
%F A366912 a(n) = Sum_{k = 1..n-1} A366911(k).
%e A366912 a(5) = A366911(1) + A366911(2) + A366911(3) + A366911(4) = 1 + 1 + 1 - 1 = 2.
%t A366912 nn = 2^16; c[_] := False; m[_] := 0; j = 1; s = b[1] = 0;
%t A366912   c[0] = c[1] = True;
%t A366912   Monitor[Do[p = Prime[n - 1]; r = Mod[j, p];
%t A366912     While[Set[k, p m[p] + r ]; c[k], m[p]++]; s += (k - j)/p;
%t A366912     Set[{a[n - 1], b[n - 1], c[k], j}, {(k - j)/p, s, True, k}],
%t A366912     {n, 2, nn + 1}], n];
%t A366912 Array[b, nn] (* _Michael De Vlieger_, Oct 27 2023 *)
%o A366912 (PARI) See Links section.
%o A366912 (Python)
%o A366912 from itertools import count, islice
%o A366912 from sympy import nextprime
%o A366912 def A366912_gen(): # generator of terms
%o A366912     a, aset, p, c = 1, {0,1}, 2, 0
%o A366912     while True:
%o A366912         k, b = divmod(a,p)
%o A366912         for i in count(-k):
%o A366912             if b not in aset:
%o A366912                 aset.add(b)
%o A366912                 a, p = b, nextprime(p)
%o A366912                 yield c
%o A366912                 c += i
%o A366912                 break
%o A366912 A366912_list = list(islice(A366912_gen(),30)) # _Chai Wah Wu_, Oct 27 2023
%Y A366912 Cf. A064289, A364054, A366911, A366913.
%K A366912 nonn
%O A366912 1,3
%A A366912 _Rémy Sigrist_, Oct 27 2023