A334893 Number of subsets of [n] avoiding 3-term arithmetic progressions and containing n if n>0.
1, 1, 2, 3, 6, 10, 17, 25, 41, 63, 109, 165, 262, 412, 643, 932, 1459, 2163, 3212, 4601, 6817, 9904, 14741, 20906, 30352, 43993, 63540, 89442, 132037, 187587, 266842, 378061, 535907, 751709, 1077809, 1499972, 2084027, 2951390, 4114165, 5651914, 7968177
Offset: 0
Keywords
Links
- Fausto A. C. Cariboni, Table of n, a(n) for n = 0..80
- Eric Weisstein's World of Mathematics, Nonaveraging Sequence
- Wikipedia, Arithmetic progression
- Wikipedia, Salem-Spencer set
- Index entries related to non-averaging sequences
Programs
-
Maple
b:= proc(n, s) option remember; `if`(n<1, 1, b(n-1, s)+ `if`(ormap(j-> 2*j-n in s, s), 0, b(n-1, s union {n}))) end: a:= n-> b(n-1, {n}): seq(a(n), n=0..23);
-
Mathematica
b[n_, s_] := b[n, s] = If[n < 1, 1, b[n-1, s] + If[AnyTrue[s, MemberQ[s, 2 # - n]&], 0, b[n-1, s ~Union~ {n}]]]; a[n_] := b[n-1, {n}]; a /@ Range[0, 23] (* Jean-François Alcover, May 03 2021, after Alois P. Heinz *)