The OEIS is supported by the many generous donors to the OEIS Foundation. Hints (Greetings from The On-Line Encyclopedia of Integer 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). 0
 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 (list; graph; refs; listen; history; text; internal format)
 OFFSET 1,4 COMMENTS Conjecture: this sequence is defined. That is, each a(n-1) appears as a partial sum starting from some offset. LINKS EXAMPLE 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. PROG (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) 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. Sequence in context: A049342 A112966 A286657 * A160570 A128830 A090387 Adjacent sequences: A334049 A334050 A334051 * A334053 A334054 A334055 KEYWORD nonn AUTHOR Ethan Goldberg, Sep 06 2020 STATUS approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified March 28 23:03 EDT 2023. Contains 361596 sequences. (Running on oeis4.)