login
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
OFFSET
1,3
LINKS
FORMULA
a(n) <= A000217(n).
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
print(list(islice(gen_a(), 60))) # Winston de Greef, Apr 15 2023
CROSSREFS
Cf. A361798 (number of sums).
Sequence in context: A007983 A049640 A179385 * A024668 A340248 A188951
KEYWORD
nonn
AUTHOR
Neal Gersh Tolunsky, Apr 15 2023
EXTENSIONS
a(13)-a(15) corrected and more terms from Winston de Greef, Apr 15 2023
STATUS
approved