login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
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

%I #15 Dec 23 2020 07:47:03

%S 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,

%T 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,

%U 31,25,5,16,7,9,7,2,27,15,12,17,29,2,6,15,6,2,4,30,18,15,6

%N 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).

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

%e 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.

%e 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.

%o (Haskell)

%o findSumRun target index runLength sum (x:xs)

%o | sum == target = index + runLength

%o | runLength == 0 = findSumRun target index 1 x (x:xs)

%o | sum > target = findSumRun target (index+1) (runLength-1) (sum-x) xs

%o | sum < target = findSumRun target index (runLength+1) (sum + ((x:xs)!!(runLength))) (x:xs)

%o step (x:xs) = findSumRun x 0 0 0 xs

%o seq 0 xs = xs

%o seq n xs = ves (n-1) ((step xs):xs)

%Y 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.

%K nonn

%O 1,4

%A _Ethan Goldberg_, Sep 06 2020

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.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 20:08 EDT 2024. Contains 371963 sequences. (Running on oeis4.)