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!)
A328342 a(0) = 0; for n > 1, if a(n-1) has appeared three or more times then a(n) = total number of terms between the last and second-last appearance of a(n-1), minus the total number of terms between the second-last and third-last appearance of a(n-1). If a(n-1) has appeared two times, a(n) = total number of terms between the last and second-last appearance of a(n-1). If a(n-1) has appeared once, a(n) = 0. 1
0, 0, 1, 0, 1, 2, 0, 1, 1, -2, 0, 1, 2, 7, 0, 0, -3, 0, 1, 4, 0, 1, -4, 0, 0, -2, 16, 0, 2, 9, 0, 0, -2, -9, 0, 2, -9, 3, 0, 1, 15, 0, -1, 0, -1, 2, 3, 9, 18, 0, 4, 31, 0, -3, 37, 0, 0, -2, 18, 10, 0, 3, 6, 0, -1, 18, -3, -24, 0, 2, 14, 0, -2, -10, 0, 0, -2, -11, 0, 2, -14 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,6
COMMENTS
For the first 10 million terms the largest positive value is 9845628 while the largest negative value is -9748780. The largest positive term that has not appeared is 30832 and the largest negative term that has not appeared is -33426. It is likely that all integers eventually appear in the sequence, although this is unproven.
LINKS
EXAMPLE
a(1) = 0 as a(1-1) = a(0) = 0 has only appeared once.
a(2) = 1 as a(2-1) = a(1) = 0 has appeared twice, and the number of terms between the last and second-last appearance of 0, a(0) and a(1), is 1
a(4) = 1. a(4-1) = a(3) = 0, which has appeared three times. The number of terms between the last and second-last appearance of 0, a(3) and a(1), is 2. The number of terms between the second-last and third-last appearance of 0, a(1) and a(0), is 1. Thus a(4) = 2 - 1 = 1.
a(9) = -2. a(9-1) = a(8) = 1, which has appeared three times. The number of terms between the last and second-last appearance of 1, a(8) and a(7), is 1. The number of terms between the second-last and third-last appearance of 1, a(7) and a(4), is 3. Thus a(9) = 1 - 3 = -2.
MATHEMATICA
s = {0}; Do[d = Differences[Position[s, _?(# == s[[-1]] &)] // Flatten]; a = Switch[Length[d], 0, 0, 1, d[[1]], _, d[[-1]] - d[[-2]]]; AppendTo[s, a], {80}]; s (* Amiram Eldar, Oct 13 2019 *)
CROSSREFS
Sequence in context: A173655 A025871 A051010 * A214269 A130027 A116949
KEYWORD
sign
AUTHOR
Scott R. Shannon, Oct 12 2019
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.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 18 03:33 EDT 2024. Contains 371767 sequences. (Running on oeis4.)