login
A267650
Stanley sequence S_4(0,3): lexicographic first increasing sequence with a(0) = 0, a(1) = 3 and no 4 terms in arithmetic progression.
1
0, 3, 4, 5, 7, 8, 10, 11, 16, 17, 18, 20, 21, 27, 28, 29, 31, 32, 34, 35, 36, 53, 55, 56, 57, 60, 61, 62, 64, 67, 69, 75, 87, 91, 100, 101, 103, 104, 105, 108, 109, 110, 114, 116, 120, 125, 127, 128, 129, 132, 134, 135, 164, 168, 173, 174, 175, 177, 181, 182, 184, 188, 190
OFFSET
0,2
COMMENTS
See A185256 for S(0,3) = S_3(0,3) and A266728 for S_5(0,3).
PROG
(PARI) a(n, show=1, L=4, v=[0, 3], 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(1..n)] as return value, else just a(n). - M. F. Hasler, Jan 18 2016
CROSSREFS
For other examples of Stanley Sequences see A005487, A005836, A187843, A188052, A188053, A188054, A188055, A188056, A188057, A266727, A266728.
See also A004793, A033160, A033163.
Sequence in context: A098090 A287127 A174681 * A270102 A026347 A187482
KEYWORD
nonn
AUTHOR
M. F. Hasler, Jan 18 2016
STATUS
approved