Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #31 Mar 04 2020 02:21:17
%S 1,1,2,2,3,2,4,3,3,4,4,5,4,6,4,7,5,5,6,5,7,6,6,7,7,8,3,5,8,5,9,7,9,8,
%T 6,8,7,10,7,11,8,8,9,9,10,8,10,9,11,9,12,6,9,13,8,11,10,10,11,11,12,7,
%U 12,8,12,9,14,10,12,10,13,9,15,7,13,10,14,11,13,11,14,12,11,15
%N a(n+1) is the number of times a(n) is the sum of one or more consecutive terms in this sequence so far with a(1) = 1.
%H Rémy Sigrist, <a href="/A331614/b331614.txt">Table of n, a(n) for n = 1..10000</a>
%H Samuel B. Reid, <a href="/A331614/a331614.png">Density plot of one billion terms</a>. This plot is normalized by column.
%e For example we look for the next 2 terms after a(7) = 4:
%e The sequence so far: 1, 1, 2, 2, 3, 2, 4.
%e We count how many times we can sum up consecutive terms to get 4 as result (and include all 4's already in the sequence).
%e There are 3 ways to get a sum of 4: 1 + 1 + 2, 2 + 2 and 4. This gives us a(8) = 3.
%e For the next term we count all sums of 3 we can get: 1 + 2, 3, 3. This means there are 3 ways and a(9) = 3.
%t a[1] = 1; a[n_] := a[n] = Block[{c = 0, j, s}, Do[j = i; s = 0; While[j < n && s < a[n - 1], s += a[j]; j++]; If[s == a[n - 1], c++], {i, n - 1}]; c]; Array[a, 84] (* _Giovanni Resta_, Jan 23 2020 *)
%t (* Second program needing version >= 10.1 *)
%t a[n_] := a[n] = If[n == 1, 1, SequenceCount[Array[a, n-1], s_ /; Total[s] == a[n-1], Overlaps -> True]];
%t Array[a, 100] (* _Jean-François Alcover_, Feb 15 2020 *)
%o (Excel)
%o Cell A1: 1
%o Cell A2: =countif(A$1:AZ1;A1)
%o Cell B2: =if(A1="";"";A1+$A2)
%o Copy B2 and paste into area B2:AZ2
%o Copy row 2 and paste down (5000 lines worked, more could be slow)
%o (PARI) for (n=1, #a=vector(#t=vector(84)), print1 (a[n]=if(n==1, 1, t[a[n-1]])", "); s=0; forstep (k=n, 1, -1, if (#t<s+=a[k], break, t[s]++))) \\ _Rémy Sigrist_, Feb 14 2020
%Y Cf. A332518.
%K nonn
%O 1,3
%A _S. Brunner_, Jan 22 2020