A007865 Number of sum-free subsets of {1, ..., n}.
1, 2, 3, 6, 9, 16, 24, 42, 61, 108, 151, 253, 369, 607, 847, 1400, 1954, 3139, 4398, 6976, 9583, 15456, 20982, 32816, 45417, 70109, 94499, 148234, 200768, 308213, 415543, 634270, 849877, 1311244, 1739022, 2630061, 3540355, 5344961, 7051789, 10747207, 14158720, 21295570, 28188520
Offset: 0
Examples
{} has one sum-free subset, the empty set, so a(0)=1. {1} has two sum-free subsets, {} and {1}, so a(1)=2. a(2) = 3: 0,1,2. a(3) = 6: 0,1,2,3,13,23. a(4) = 9: 0,1,2,3,4,13,14,23,34.
References
- S. R. Finch, Mathematical Constants, Cambridge, 2003, pp. 180-183.
Links
- Fausto A. C. Cariboni, Table of n, a(n) for n = 0..88, (terms up to a(70) from Per Hakan Lundow)
- József Balogh, Hong Liu, Maryam Sharifzadeh, and Andrew Treglown, Sharp bound on the number of maximal sum-free subsets of integers, J. Eur. Math. Soc. 20 (2018), no. 8, pp. 1885-1911, also arXiv:1502.07605, Feb. 2015.
- P. J. Cameron and P. Erdős, On the number of integers with various properties, in R. A. Mullin, ed., Number Theory: Proc. First Conf. of Canad. Number Theory Assoc. Conf., Banff, De Gruyter, Berlin, 1990, pp. 61-79.
- Steven R. Finch, Several Problems Concerning Sum-Free Sets [Broken link]
- Steven R. Finch, Several Problems Concerning Sum-Free Sets [From the Wayback machine]
- Ben Green and Imre Z. Ruzsa, Sum-free sets in abelian groups, arXiv:math/0307142 [math.CO], 2004.
- A. A. Sapozhenko, The Cameron-Erdős conjecture, Discrete Math., 308 (2008), 4361-4369.
- Eric Weisstein's World of Mathematics, Sum-Free Set
Crossrefs
Programs
-
Maple
S3S:= {{}}: a[0]:= 1: for n from 1 to 35 do S3S:= S3S union map(t -> t union {n}, select(t -> (t intersect map(q -> n-q,t)={}),S3S)); a[n]:= nops(S3S) od: seq(a[n],n=0..35); # Code for computing (the number of) sum-free subsets of {1, ..., n} - Robert Israel
-
Mathematica
SumFreeSet[ 0 ] = {{}}; SumFreeSet[ n_ ] := SumFreeSet[ n ] = Union[ SumFreeSet[ n - 1 ], Union[ #, {n} ] & /@ Select[ SumFreeSet[ n - 1 ], Intersection[ #, n - # ] == {} & ] ] As a check, enter Length /@ SumFreeSet /@ Range[ 0, 30 ] Alternatively, use NestList. n = 0; Length /@ NestList[ (++n; Union[ #, Union[ #, {n} ] & /@ Select[ #, Intersection[ #, n - # ] == {} & ] ]) &, {{}}, 30 ] (* from Paul Abbott, based on Robert Israel's Maple code *) Timing[ n = 0; Last[ Reap[ Nest[ (++n; Sow[ Length[ # ] ]; Union[ #, Union[ #, {n} ]& /@ Select[ #, Intersection[ #, n - # ] == {} & ] ]) &, {{}}, 36 ] ] ] ] (* improved code from Paul Abbott, Nov 24 2005 *) Table[Length[Select[Subsets[Range[n]],Intersection[#,Total/@Tuples[#,2]]=={}&]],{n,1,10}] (* Gus Wiseman, Jul 08 2019 *)
-
PARI
\\ good only for n <= 25: sumfree(v) = {for(i=1, #v, for (j=1, i, if (setsearch(v, v[i]+v[j]), return (0)););); return (1);} a(n) = {my(nb = 0); forsubset(n, s, if (sumfree(Set(s)), nb++);); nb;} \\ Michel Marcus, Nov 08 2020
Formula
Extensions
More terms from John W. Layman, Oct 21 2000
Extended through a(35) by Robert Israel, Nov 16 2005
a(36)-a(37) from Alec Mihailovs (alec(AT)mihailovs.com) (using Robert Israel's procedure), Nov 16 2005
a(38) from Eric W. Weisstein, Nov 17 2005
a(39)-a(42) from Eric W. Weisstein, Nov 28 2005, using Paul Abbott's Mathematica code
Comments