cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A248641 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.

This page as a plain text file.
%I A248641 #29 Aug 28 2019 12:52:51
%S A248641 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 A248641 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 A248641 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 A248641 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 A248641 See A248625 for more information, links and examples.
%C A248641 It is a variation of A229037 where 3-term is replaced by 4-term (and with “lead index” 0 instead of 1)
%H A248641 Sébastien Palcoux, <a href="/A248641/b248641.txt">Table of n, a(n) for n = 0..10000</a>
%o A248641 (PARI) a=[];for(n=1,190,a=concat(a,1);while(hasAP(a,4),a[#a]++));a \\ See A248625 for hasAP().
%o A248641 (SageMath)
%o A248641 cpdef FourFree(int n):
%o A248641    cdef int i, r, k, s, L1, L2, L3
%o A248641    cdef list L, Lb
%o A248641    cdef set b
%o A248641    L=[1, 1, 1]
%o A248641    for k in range(3, n):
%o A248641       b=set()
%o A248641       for i in range(k):
%o A248641          if 3*((k-i)/3)==k-i:
%o A248641             r=(k-i)/3
%o A248641             L1, L2, L3=L[i], L[i+r], L[i+2*r]
%o A248641             s=3*(L2-L1)+L1
%o A248641             if s>0 and L3==2*(L2-L1)+L1:
%o A248641                b.add(s)
%o A248641       if 1 not in b:
%o A248641          L.append(1)
%o A248641       else:
%o A248641          Lb=list(b)
%o A248641          Lb.sort()
%o A248641          for t in Lb:
%o A248641             if t+1 not in b:
%o A248641                L.append(t+1)
%o A248641                break
%o A248641    return L
%o A248641 # _Sébastien Palcoux_, Aug 28 2019
%Y A248641 Cf. A248625, A248639, A248640, A248627, A229037, A241752.
%K A248641 nonn,easy
%O A248641 0,4
%A A248641 _M. F. Hasler_, Oct 10 2014