login
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

%I #11 Apr 04 2015 21:46:57

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

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

%U 9,7,10,12,9,11,9,9,11,9,10,13,19,12,0,0,1,0,0,1,1,3,3

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

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

%C Every nonnegative integer seems to appear in this sequence - see A248627 for the corresponding indices.

%C Sequence A229037 is the analog for positive integers (and indices).

%F a(n) = A229037(n+1)+1.

%e Start with a(0)=a(1)=0, smallest possible choice and trivially satisfying the constraint since no 3-term subsequence is possible.

%e Then one must take a(2)=1 since otherwise [0,0,0] would be an AP.

%e Then one can take again a(3)=a(4)=0, and a(5)=1.

%e Now appending 0 would yield the AP (0,0,0) by extracting terms with indices 0,3,6; therefore a(6)=1.

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

%o (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

%o ([i,s,t])))]; a=[]; for(n=1,90,a=concat(a,0);while(hasAP(a),a[#a]++);print1(a[#a]","));a

%Y Cf. A005836, A005839, A023717, ..., A020664.

%Y Cf. A248627, A229037, A241752.

%K nonn

%O 0,8

%A _M. F. Hasler_, Oct 10 2014