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.
%I A266727 #29 Apr 20 2023 09:23:34 %S A266727 0,1,7,8,10,11,17,18,30,31,37,38,40,41,47,48,90,91,97,98,100,101,107, %T A266727 108,120,121,127,128,130,131,137,138,270,271,277,278,280,281,287,288, %U A266727 300,301,307,308,310,311,317,318,360,361,367,368,370,371,377,378,390 %N A266727 Stanley sequence S(0,1,7). %C A266727 Lexicographic first increasing sequence starting (0, 1, 7, ...) and such that no 3 terms are in arithmetic progression. - _M. F. Hasler_, Jan 18 2016 %H A266727 Chai Wah Wu, <a href="/A266727/b266727.txt">Table of n, a(n) for n = 0..8191</a> %H A266727 R. A. Moy and D. Rolnick, <a href="http://arxiv.org/abs/1502.06013">Novel structures in Stanley sequences</a>, arXiv:1502.06013 [math.CO], 2015. %H A266727 R. A. Moy and D. Rolnick, <a href="http://dx.doi.org/10.1016/j.disc.2015.10.017">Novel structures in Stanley sequences</a>, Discrete Math., 339 (2016), 689-698. %H A266727 A. M. Odlyzko and R. P. Stanley, <a href="https://math.mit.edu/~rstan/papers/od.pdf">Some curious sequences constructed with the greedy algorithm</a>, 1978. %e A266727 a(3) = 8 because no 3 terms among (0,1,7,8) are in AP. a(4) is not 9 because (7,8,9) would be an AP, which is excluded. a(4) = 10 works, a(5) = 11 also. %e A266727 For a(6), 12 is forbidden because of (8,10,12), 13 because of (7,10,13), 14 because of (8,11,14), 15 because of (7,11,15), 16 because of (0,8,16), thus a(6) = 17 is the smallest possible choice. - _M. F. Hasler_, Jan 18 2016 %t A266727 s = {0, 1, 7}; %t A266727 next[] := For[k = Last[s]+1; AppendTo[s, 0];, True, k++, s[[-1]] = k; sp = SequencePosition[s, {___, a_, ___, b_, ___, c_, ___} /; b-a == c-b, 1]; If[sp == {}, Print[k]; Break[]]]; %t A266727 Do[next[], {60}]; %t A266727 s (* _Jean-François Alcover_, Oct 04 2018 *) %o A266727 (Python) %o A266727 A266727_list = [0,1,7] %o A266727 for i in range(1000): %o A266727 n, flag = A266727_list[-1]+1, False %o A266727 while True: %o A266727 for j in range(i+2,0,-1): %o A266727 m = 2*A266727_list[j]-n %o A266727 if m in A266727_list: %o A266727 break %o A266727 if m < A266727_list[0]: %o A266727 flag = True %o A266727 break %o A266727 else: %o A266727 A266727_list.append(n) %o A266727 break %o A266727 if flag: %o A266727 A266727_list.append(n) %o A266727 break %o A266727 n += 1 # _Chai Wah Wu_, Jan 05 2016 %o A266727 (PARI) A266727(n,show=1,L=3,v=[0,1,7],D=v->v[2..-1]-v[1..-2])={while(#v<=n, show&&print1(v[#v]","); v=concat(v,v[#v]); while(v[#v]++, forvec(i=vector(L,j,[if(j<L,j,#v),#v]),#Set(D(vecextract(v,i)))>1||next(2),2);break)); if(type(show)=="t_VEC",v,v[n+1])} \\ 2nd (optional) arg: zero = silent, nonzero = verbose, vector (e.g. [] or [1]) = get the whole list [a(0..n)] as return value, else just a(n). - _M. F. Hasler_, Jan 18 2016 %Y A266727 Cf. A005836, A188053, A266728. %K A266727 nonn %O A266727 0,3 %A A266727 _N. J. A. Sloane_, Jan 04 2016