%I #31 Nov 10 2025 21:50:42
%S 1,1,2,3,6,10,17,25,41,63,109,165,262,412,643,932,1459,2163,3212,4601,
%T 6817,9904,14741,20906,30352,43993,63540,89442,132037,187587,266842,
%U 378061,535907,751709,1077809,1499972,2084027,2951390,4114165,5651914,7968177
%N Number of subsets of [n] avoiding 3-term arithmetic progressions and containing n if n>0.
%H Fausto A. C. Cariboni, <a href="/A334893/b334893.txt">Table of n, a(n) for n = 0..80</a>
%H Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/NonaveragingSequence.html">Nonaveraging Sequence</a>
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Arithmetic_progression">Arithmetic progression</a>
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Salem-Spencer_set">Salem-Spencer set</a>
%H <a href="https://oeis.org/wiki/Index_to_OEIS:_Section_No#non_averaging">Index entries related to non-averaging sequences</a>
%p b:= proc(n, s) option remember; `if`(n<1, 1, b(n-1, s)+
%p `if`(ormap(j-> 2*j-n in s, s), 0, b(n-1, s union {n})))
%p end:
%p a:= n-> b(n-1, {n}):
%p seq(a(n), n=0..23);
%t b[n_, s_] := b[n, s] = If[n < 1, 1, b[n-1, s] +
%t If[AnyTrue[s, MemberQ[s, 2 # - n]&], 0, b[n-1, s ~Union~ {n}]]];
%t a[n_] := b[n-1, {n}];
%t a /@ Range[0, 23] (* _Jean-François Alcover_, May 03 2021, after _Alois P. Heinz_ *)
%Y Row sums of A334892.
%Y Partial sums give A051013.
%K nonn
%O 0,3
%A _Alois P. Heinz_, May 14 2020