A366912 Partial sums of A366911: a(1) = 0, and for n > 0, a(n+1) = a(n) + A366911(n).
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
Keywords
Examples
a(5) = A366911(1) + A366911(2) + A366911(3) + A366911(4) = 1 + 1 + 1 - 1 = 2.
Links
- Rémy Sigrist, Colored scatterplot of the first 100000 terms of A364054 (where the color is function of a(n))
- Rémy Sigrist, PARI program
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).
Comments