cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

This page as a plain text file.
%I A362040 #46 Apr 19 2023 09:04:41
%S A362040 0,1,2,4,7,10,15,21,26,34,42,52,63,75,86,96,109,125,142,160,179,197,
%T A362040 216,238,259,281,306,332,359,387,416,442,473,505,536,567,600,636,669,
%U A362040 707,746,784,823,865,906,948,992,1036,1083,1129,1172,1222,1269,1321,1374,1428
%N A362040 a(n) is the number of distinct sums of one or more contiguous terms in the sequence thus far.
%H A362040 Winston de Greef, <a href="/A362040/b362040.txt">Table of n, a(n) for n = 1..10000</a>
%F A362040 a(n) <= A000217(n).
%e A362040 At n=1, there are no contiguous subsequences, so a(1)=0.
%e A362040 At n=2, there is one contiguous subsequence: [0], so a(2)=1.
%e A362040 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 A362040 (Python)
%o A362040 from itertools import islice
%o A362040 def gen_a():
%o A362040     seen = set()
%o A362040     sums = []
%o A362040     new = 0
%o A362040     while True:
%o A362040         for v in sums: seen.add(v + new)
%o A362040         sums = [v + new for v in sums]
%o A362040         sums.append(0)
%o A362040         new = len(seen)
%o A362040         yield new
%o A362040 print(list(islice(gen_a(), 60))) # _Winston de Greef_, Apr 15 2023
%Y A362040 Cf. A361798 (number of sums).
%Y A362040 Cf. A000217, A002048, A002049.
%K A362040 nonn
%O A362040 1,3
%A A362040 _Neal Gersh Tolunsky_, Apr 15 2023
%E A362040 a(13)-a(15) corrected and more terms from _Winston de Greef_, Apr 15 2023