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.

A331614 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.

Original entry on oeis.org

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, 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, 12, 8, 12, 9, 14, 10, 12, 10, 13, 9, 15, 7, 13, 10, 14, 11, 13, 11, 14, 12, 11, 15
Offset: 1

Views

Author

S. Brunner, Jan 22 2020

Keywords

Examples

			For example we look for the next 2 terms after a(7) = 4:
The sequence so far: 1, 1, 2, 2, 3, 2, 4.
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).
There are 3 ways to get a sum of 4: 1 + 1 + 2, 2 + 2 and 4. This gives us a(8) = 3.
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.
		

Crossrefs

Cf. A332518.

Programs

  • Excel
    Cell A1: 1
    Cell A2: =countif(A$1:AZ1;A1)
    Cell B2: =if(A1="";"";A1+$A2)
    Copy B2 and paste into area B2:AZ2
    Copy row 2 and paste down (5000 lines worked, more could be slow)
    
  • Mathematica
    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 *)
    (* Second program needing version >= 10.1 *)
    a[n_] := a[n] = If[n == 1, 1, SequenceCount[Array[a, n-1], s_ /; Total[s] == a[n-1], Overlaps -> True]];
    Array[a, 100] (* Jean-François Alcover, Feb 15 2020 *)
  • 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 (#tRémy Sigrist, Feb 14 2020