login
A358537
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.
3
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, 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, 18, 14, 9, 40, 9, 29, 32, 23, 6, 17, 23, 16, 8, 26, 32, 35, 27, 64, 10
OFFSET
0,3
LINKS
EXAMPLE
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.
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.
MAPLE
N:= 100: V:= Array(0..N):
V[0]:= 1:
for n from 0 to N-1 do
s:= 0;
for j from n to 0 by -1 do
s:= s + V[j];
if s > N then break fi;
if s > n then V[s]:= V[s] + n-j+1 fi;
od;
od:
convert(V, list); # Robert Israel, Feb 16 2023
PROG
(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
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Neal Gersh Tolunsky, Dec 18 2022
EXTENSIONS
Data edited by Yifan Xie, Feb 08 2023
More terms from Rémy Sigrist, Feb 09 2023
STATUS
approved