login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A248625
Lexicographically earliest sequence of nonnegative integers such that no triple (a(n),a(n+d),a(n+2d)) is in arithmetic progression, for any d>0, n>=0.
6
0, 0, 1, 0, 0, 1, 1, 3, 3, 0, 0, 1, 0, 0, 1, 1, 3, 3, 1, 3, 3, 4, 4, 7, 4, 4, 8, 0, 0, 1, 0, 0, 1, 1, 3, 3, 0, 0, 1, 0, 0, 1, 1, 3, 3, 1, 3, 3, 4, 4, 7, 4, 4, 8, 8, 3, 3, 4, 4, 9, 4, 4, 9, 1, 9, 12, 10, 9, 7, 10, 12, 9, 11, 9, 9, 11, 9, 10, 13, 19, 12, 0, 0, 1, 0, 0, 1, 1, 3, 3
OFFSET
0,8
COMMENTS
The sequence is constructed in the greedy way, appending at each step the least nonnegative integer such that no subsequence of equidistant terms contains an AP.
Every nonnegative integer seems to appear in this sequence - see A248627 for the corresponding indices.
Sequence A229037 is the analog for positive integers (and indices).
FORMULA
a(n) = A229037(n+1)+1.
EXAMPLE
Start with a(0)=a(1)=0, smallest possible choice and trivially satisfying the constraint since no 3-term subsequence is possible.
Then one must take a(2)=1 since otherwise [0,0,0] would be an AP.
Then one can take again a(3)=a(4)=0, and a(5)=1.
Now appending 0 would yield the AP (0,0,0) by extracting terms with indices 0,3,6; therefore a(6)=1.
Now a(7) cannot be 0 not 1 nor 2 since else a(3)=0, a(5)=1, a(7)=2 would be an AP, therefore a(7)=3 is the least possible choice.
PROG
(PARI) [DD(v)=vecextract(v, "^1")-vecextract(v, "^-1"), hasAP(a, m=3)=u=vector(m, i, 1); v=vector(m, i, i-1); for(i=1, #a-m+1, for(s=1, (#a-i)\(m-1), #Set(DD(t=vecextract(a, (i)*u+s*v)))==1&&return
([i, s, t])))]; a=[]; for(n=1, 90, a=concat(a, 0); while(hasAP(a), a[#a]++); print1(a[#a]", ")); a
CROSSREFS
KEYWORD
nonn
AUTHOR
M. F. Hasler, Oct 10 2014
STATUS
approved