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.

User: Ethan Goldberg

Ethan Goldberg's wiki page.

Ethan Goldberg has authored 1 sequences.

A334052 Variant of Van Eck's sequence: Set a(1) = 1, a(2) = 0, a(3) = 1. Thereafter, a(n) is the minimum positive offset i from a(n-1) such that some partial sum a(n-1-i)+...+a(n-1-i+k) = a(n-1) (0 <= k < i).

Original entry on oeis.org

1, 0, 1, 2, 3, 2, 2, 1, 5, 3, 3, 1, 4, 2, 7, 3, 5, 5, 1, 7, 5, 3, 6, 5, 3, 3, 1, 8, 4, 3, 4, 2, 18, 10, 17, 12, 8, 9, 8, 2, 8, 2, 2, 1, 17, 7, 16, 20, 5, 7, 4, 9, 14, 13, 3, 12, 7, 7, 1, 15, 3, 6, 31, 25, 5, 16, 7, 9, 7, 2, 27, 15, 12, 17, 29, 2, 6, 15, 6, 2, 4, 30, 18, 15, 6
Offset: 1

Author

Ethan Goldberg, Sep 06 2020

Keywords

Comments

Conjecture: this sequence is defined. That is, each a(n-1) appears as a partial sum starting from some offset.

Examples

			For n=3 (the first term after the initial conditions), we are looking for a run that sums to a(2) = 1 (and doesn't include a(2)). The most recent such run starts at a(1) = 1, and goes for one place. So a(3) = 2, the distance from a(n-1) to the beginning of the run.
For n=4, we are looking for a run that sums to 2. The last such run is a(1) + a(2) + a(3), at a distance of 3 away. so a(4) = 3.
		

Crossrefs

Similar to A181391. Along the same lines as A333210, which looks for pairs with a particular sum. By adding a restriction that the runs have a maximum length of 1, we recover Van Eck's sequence.

Programs

  • Haskell
    findSumRun target index runLength sum (x:xs)
      | sum == target = index + runLength
      | runLength == 0 = findSumRun target index 1 x (x:xs)
      | sum > target = findSumRun target (index+1) (runLength-1) (sum-x) xs
      | sum < target = findSumRun target index (runLength+1) (sum + ((x:xs)!!(runLength))) (x:xs)
    step (x:xs) = findSumRun x 0 0 0 xs
    seq 0 xs = xs
    seq n xs = ves (n-1) ((step xs):xs)