login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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
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
FORMULA
a(n) = Sum_{k = 1..n-1} A366911(k).
EXAMPLE
a(5) = A366911(1) + A366911(2) + A366911(3) + A366911(4) = 1 + 1 + 1 - 1 = 2.
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 *)
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
A366912_list = list(islice(A366912_gen(), 30)) # Chai Wah Wu, Oct 27 2023
CROSSREFS
Sequence in context: A132423 A071995 A114108 * A276090 A073820 A103509
KEYWORD
nonn
AUTHOR
Rémy Sigrist, Oct 27 2023
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified July 24 03:05 EDT 2024. Contains 374575 sequences. (Running on oeis4.)