login
a(n) is the number of distinct sums of one or more contiguous terms in the sequence thus far.
2

%I #46 Apr 19 2023 09:04:41

%S 0,1,2,4,7,10,15,21,26,34,42,52,63,75,86,96,109,125,142,160,179,197,

%T 216,238,259,281,306,332,359,387,416,442,473,505,536,567,600,636,669,

%U 707,746,784,823,865,906,948,992,1036,1083,1129,1172,1222,1269,1321,1374,1428

%N a(n) is the number of distinct sums of one or more contiguous terms in the sequence thus far.

%H Winston de Greef, <a href="/A362040/b362040.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) <= A000217(n).

%e At n=1, there are no contiguous subsequences, so a(1)=0.

%e At n=2, there is one contiguous subsequence: [0], so a(2)=1.

%e 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.

%o (Python)

%o from itertools import islice

%o def gen_a():

%o seen = set()

%o sums = []

%o new = 0

%o while True:

%o for v in sums: seen.add(v + new)

%o sums = [v + new for v in sums]

%o sums.append(0)

%o new = len(seen)

%o yield new

%o print(list(islice(gen_a(), 60))) # _Winston de Greef_, Apr 15 2023

%Y Cf. A361798 (number of sums).

%Y Cf. A000217, A002048, A002049.

%K nonn

%O 1,3

%A _Neal Gersh Tolunsky_, Apr 15 2023

%E a(13)-a(15) corrected and more terms from _Winston de Greef_, Apr 15 2023