OFFSET
0,2
LINKS
Neal Gersh Tolunsky, Table of n, a(n) for n = 0..10000
Neal Gersh Tolunsky, Graph of first 10000 terms
Neal Gersh Tolunsky, Graph of first 100000 terms
EXAMPLE
a(2)=1 because in the sequence thus far (1, 2), there is only one contiguous subsequence that sums to n=2: (2).
a(7)=3 because in the sequence thus far (1, 2, 1, 2, 1, 1, 2), there are three groups of consecutive terms that sum to n=7: (1, 2, 1, 2, 1); (2, 1, 2, 1, 1); (1, 2, 1, 1, 2).
PROG
(Python)
from collections import Counter
from itertools import count, islice
def agen(): # generator of terms
yield from [1, 2]
sumsn, c = [2, 3], Counter([1, 2, 3])
for n in count(2):
an = c[n]
yield an
sumsn = [an] + [s + an for s in sumsn]
c.update(sumsn)
print(list(islice(agen(), 86))) # Michael S. Branicky, May 25 2023
CROSSREFS
KEYWORD
nonn
AUTHOR
Neal Gersh Tolunsky, May 25 2023
STATUS
approved