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
Scott R. Shannon, Java code to produce the sequence.
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
KEYWORD
sign
AUTHOR
Scott R. Shannon, Oct 12 2019
STATUS
approved