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

Original entry on oeis.org

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, 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, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 8, 6, 7, 8, 9, 8, 9, 8
Offset: 1

Views

Author

Rémy Sigrist, Oct 27 2023

Keywords

Comments

By analogy with A064289, a(n) corresponds to the height of A364054(n) = number of addition steps - number of subtraction steps to produce it.

Examples

			a(5) = A366911(1) + A366911(2) + A366911(3) + A366911(4) = 1 + 1 + 1 - 1 = 2.
		

Crossrefs

Programs

  • Mathematica
    nn = 2^16; c[] := False; m[] := 0; j = 1; s = b[1] = 0;
      c[0] = c[1] = True;
      Monitor[Do[p = Prime[n - 1]; r = Mod[j, p];
        While[Set[k, p m[p] + r ]; c[k], m[p]++]; s += (k - j)/p;
        Set[{a[n - 1], b[n - 1], c[k], j}, {(k - j)/p, s, True, k}],
        {n, 2, nn + 1}], n];
    Array[b, nn] (* Michael De Vlieger, Oct 27 2023 *)
  • PARI
    See Links section.
    
  • Python
    from itertools import count, islice
    from sympy import nextprime
    def A366912_gen(): # generator of terms
        a, aset, p, c = 1, {0,1}, 2, 0
        while True:
            k, b = divmod(a,p)
            for i in count(-k):
                if b not in aset:
                    aset.add(b)
                    a, p = b, nextprime(p)
                    yield c
                    c += i
                    break
    A366912_list = list(islice(A366912_gen(),30)) # Chai Wah Wu, Oct 27 2023

Formula

a(n) = Sum_{k = 1..n-1} A366911(k).