|
|
A366912
|
|
Partial sums of A366911: a(1) = 0, and for n > 0, a(n+1) = a(n) + A366911(n).
|
|
3
|
|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,3
|
|
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.
|
|
LINKS
|
|
|
FORMULA
|
a(n) = Sum_{k = 1..n-1} A366911(k).
|
|
EXAMPLE
|
|
|
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];
|
|
PROG
|
(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
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|