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”).

Lexicographically earliest positive sequence which does not contain a 4-term equidistant subsequence (a(n+k*d); k=0,1,2,3) in arithmetic progression.
3

%I #29 Aug 28 2019 12:52:51

%S 1,1,1,2,1,1,2,1,1,1,2,2,2,3,1,1,1,2,1,2,2,2,3,3,3,1,1,3,1,1,1,2,2,1,

%T 2,2,1,2,2,2,3,3,2,3,2,3,3,5,1,1,1,3,1,1,3,1,1,1,2,2,2,3,1,2,1,1,1,2,

%U 2,2,3,4,2,3,2,2,2,3,3,1,3,3,3,5,5,4,1,1,1,3,1,2,3,1,5,3,2,6,1,3,2,2,3,2,1,1,3,3,1,1,1

%N Lexicographically earliest positive sequence which does not contain a 4-term equidistant subsequence (a(n+k*d); k=0,1,2,3) in arithmetic progression.

%C See A248625 for more information, links and examples.

%C It is a variation of A229037 where 3-term is replaced by 4-term (and with “lead index” 0 instead of 1)

%H Sébastien Palcoux, <a href="/A248641/b248641.txt">Table of n, a(n) for n = 0..10000</a>

%o (PARI) a=[];for(n=1,190,a=concat(a,1);while(hasAP(a,4),a[#a]++));a \\ See A248625 for hasAP().

%o (SageMath)

%o cpdef FourFree(int n):

%o cdef int i, r, k, s, L1, L2, L3

%o cdef list L, Lb

%o cdef set b

%o L=[1, 1, 1]

%o for k in range(3, n):

%o b=set()

%o for i in range(k):

%o if 3*((k-i)/3)==k-i:

%o r=(k-i)/3

%o L1, L2, L3=L[i], L[i+r], L[i+2*r]

%o s=3*(L2-L1)+L1

%o if s>0 and L3==2*(L2-L1)+L1:

%o b.add(s)

%o if 1 not in b:

%o L.append(1)

%o else:

%o Lb=list(b)

%o Lb.sort()

%o for t in Lb:

%o if t+1 not in b:

%o L.append(t+1)

%o break

%o return L

%o # _Sébastien Palcoux_, Aug 28 2019

%Y Cf. A248625, A248639, A248640, A248627, A229037, A241752.

%K nonn,easy

%O 0,4

%A _M. F. Hasler_, Oct 10 2014