%I #71 Feb 16 2023 19:41:39
%S 1,1,2,2,5,4,4,2,2,5,7,8,6,11,10,16,5,22,6,19,15,22,20,9,18,5,14,16,
%T 23,9,8,11,16,12,19,21,0,21,8,20,11,17,25,28,4,18,4,30,23,40,7,20,18,
%U 18,14,9,40,9,29,32,23,6,17,23,16,8,26,32,35,27,64,10
%N For n > 0, a(n) is the total number of terms in all contiguous subsequences of the terms up to a(n-1) that sum to n; a(0) = 1.
%H Robert Israel, <a href="/A358537/b358537.txt">Table of n, a(n) for n = 0..10000</a>
%e To find a(4), we look at the sequence so far (1, 1, 2, 2) to find contiguous subsequences that sum to 4: (1, 1, 2) and (2, 2). This is five terms in total, so a(4) = 5. Notice that the two subsequences overlap.
%e a(40) is 11 because the following contiguous subsequences sum to 40: (6, 19, 15); (23, 9, 8); (19, 21); (19, 21, 0). This is a total of 11 terms.
%p N:= 100: V:= Array(0..N):
%p V[0]:= 1:
%p for n from 0 to N-1 do
%p s:= 0;
%p for j from n to 0 by -1 do
%p s:= s + V[j];
%p if s > N then break fi;
%p if s > n then V[s]:= V[s] + n-j+1 fi;
%p od;
%p od:
%p convert(V,list); # _Robert Israel_, Feb 16 2023
%o (PARI) { for (n=1, #a=m=vector(72), print1 (a[n] = if (n==1, 1, m[n-1])", "); s = w = 0; forstep (k=n, 1, -1, w++; if ((s += a[k]) > #m, break, s, m[s] += w))) } \\ _Rémy Sigrist_, Feb 09 2023
%Y Cf. A359034, A331614, A359634.
%K nonn,look
%O 0,3
%A _Neal Gersh Tolunsky_, Dec 18 2022
%E Data edited by _Yifan Xie_, Feb 08 2023
%E More terms from _Rémy Sigrist_, Feb 09 2023