|
|
A362040
|
|
a(n) is the number of distinct sums of one or more contiguous terms in the sequence thus far.
|
|
2
|
|
|
0, 1, 2, 4, 7, 10, 15, 21, 26, 34, 42, 52, 63, 75, 86, 96, 109, 125, 142, 160, 179, 197, 216, 238, 259, 281, 306, 332, 359, 387, 416, 442, 473, 505, 536, 567, 600, 636, 669, 707, 746, 784, 823, 865, 906, 948, 992, 1036, 1083, 1129, 1172, 1222, 1269, 1321, 1374, 1428
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,3
|
|
LINKS
|
|
|
FORMULA
|
|
|
EXAMPLE
|
At n=1, there are no contiguous subsequences, so a(1)=0.
At n=2, there is one contiguous subsequence: [0], so a(2)=1.
At n=3, there are three contiguous subsequences: [0], [1] and [0, 1], but only two distinct sums (0 and 1), so a(3)=2.
|
|
PROG
|
(Python)
from itertools import islice
def gen_a():
seen = set()
sums = []
new = 0
while True:
for v in sums: seen.add(v + new)
sums = [v + new for v in sums]
sums.append(0)
new = len(seen)
yield new
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|