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.

A005487 Starts 0, 4 and contains no 3-term arithmetic progression.

This page as a plain text file.
%I A005487 M3243 #40 Sep 07 2023 04:10:28
%S A005487 0,4,5,7,11,12,16,23,26,31,33,37,38,44,49,56,73,78,80,85,95,99,106,
%T A005487 124,128,131,136,143,169,188,197,203,220,221,226,227,238,247,259,269,
%U A005487 276,284,287,302,308,310,313,319,337,385,392,397,422,434,455,466,470
%N A005487 Starts 0, 4 and contains no 3-term arithmetic progression.
%C A005487 This is what would now be called the Stanley Sequence S(0,4). See A185256.
%D A005487 R. K. Guy, Unsolved Problems in Number Theory, E10.
%D A005487 N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H A005487 Chai Wah Wu, <a href="/A005487/b005487.txt">Table of n, a(n) for n = 0..10000</a>
%H A005487 P. Erdős, V. Lev, G. Rauzy, C. Sandor, and A. Sarkozy, <a href="https://doi.org/10.1016/S0012-365X(98)00385-9">Greedy algorithm, arithmetic progressions, subset sums and divisibility</a>, Discrete Mathematics 200 (1999), pp. 119-135.
%H A005487 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 A005487 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 A005487 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.
%H A005487 <a href="http://oeis.org/wiki/Index_to_OEIS:_Section_No#non_averaging">Index entries related to non-averaging sequences</a>
%t A005487 ss[s1_, M_] := Module[{n, chvec, swi, p, s2, i, j, t1, mmm}, t1 = Length[s1]; mmm = 1000; s2 = Table[s1, {t1 + M}] // Flatten; chvec = Array[0&, mmm]; For[i = 1 , i <= t1 , i++, chvec[[s2[[i]] ]] = 1]; (* get n-th term *) For[n = t1+1 , n <= t1 + M , n++, (* try i as next term *) For[i = s2[[n-1]] + 1 , i <= mmm , i++, swi = -1; (* test against j-th term *) For[ j = 1 , j <= n-2 , j++, p = s2[[n - j]]; If[ 2*p - i < 0 , Break[] ]; If[ chvec[[2*p - i]] == 1 , swi = 1; Break[] ] ]; If[ swi == -1 , s2[[n]] = i; chvec[[i]] = 1; Break[] ] ]; If[ swi == 1 , Print["Error, no solution at n = ", n] ] ]; Table[s2[[i]], {i, 1, t1+M}] ]; ss[{0, 4}, 80] (* _Jean-François Alcover_, Sep 10 2013, translated from Maple program given in A185256 *)
%o A005487 (Python)
%o A005487 A005487_list = [0,4]
%o A005487 for i in range(101-2):
%o A005487     n, flag = A005487_list[-1]+1, False
%o A005487     while True:
%o A005487         for j in range(i+1,0,-1):
%o A005487             m = 2*A005487_list[j]-n
%o A005487             if m in A005487_list:
%o A005487                 break
%o A005487             if m < A005487_list[0]:
%o A005487                 flag = True
%o A005487                 break
%o A005487         else:
%o A005487             A005487_list.append(n)
%o A005487             break
%o A005487         if flag:
%o A005487             A005487_list.append(n)
%o A005487             break
%o A005487         n += 1 # _Chai Wah Wu_, Jan 05 2016
%Y A005487 Equals A033158(n+1)-1. Cf. A185256.
%K A005487 nonn,nice
%O A005487 0,2
%A A005487 _N. J. A. Sloane_
%E A005487 Name clarified by _Charles R Greathouse IV_, Jan 30 2014