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.

User: Ben Burns

Ben Burns's wiki page.

Ben Burns has authored 5 sequences.

A288888 a(n) is the total number of elements in all sum-free subsets of {1,...,n}.

Original entry on oeis.org

1, 2, 7, 12, 27, 45, 93, 144, 294, 428, 796, 1220, 2186, 3155, 5637, 8102, 13907, 20070, 33746, 47416, 81050, 112226, 184541, 260780, 421222, 577447, 947934, 1304821, 2087701, 2857024, 4535223, 6157288, 9878133, 13257735, 20790674, 28332734, 44304037, 59072318
Offset: 1

Author

Ben Burns, Jun 18 2017

Keywords

Comments

a(n) is the sum of the n-th row of A288887.

Examples

			A288887 begins:
  1;
  1,  1;
  2,  2,  3;
  3,  2,  4,  3;
  5,  3,  7,  5,  7;
  ...
		

Crossrefs

Cf. A007865. Rows sums of triangle A288887.

Programs

  • PARI
    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 (#s && sumfree(Set(s)), nb += #s);); nb;} \\ Michel Marcus, Nov 08 2020

A288728 Number of sum-free sets that can be created by adding n to all sum-free sets [1..n-1].

Original entry on oeis.org

1, 1, 3, 3, 7, 8, 18, 19, 47, 43, 102, 116, 238, 240, 553, 554, 1185, 1259, 2578, 2607, 5873, 5526, 11834, 12601, 24692, 24390, 53735, 52534, 107445, 107330, 218727, 215607, 461367, 427778, 891039, 910294, 1804606, 1706828, 3695418, 3411513, 7136850, 6892950
Offset: 1

Author

Ben Burns, Jun 14 2017

Keywords

Comments

Using the standard definition of sum-free set, this is simply the difference of successive terms in A007865.
Number of subsets of {1..n} containing n but not containing the sum of any other two elements (repeats allowed). Also the number of sum-free sets (A007865) with maximum n. - Gus Wiseman, Aug 12 2023

Examples

			1 can be added to {};
2 can be added to {} but not {1};
3 can be added to {},{1},{2};
4 can be added to {},{1},{3} but not {2},{1,3},{2,3}.
From _Gus Wiseman_, Aug 12 2023: (Start)
The a(1) = 1 through a(7) = 18 sum-free sets with maximum n:
  {1}  {2}  {3}    {4}    {5}      {6}      {7}
            {1,3}  {1,4}  {1,5}    {1,6}    {1,7}
            {2,3}  {3,4}  {2,5}    {2,6}    {2,7}
                          {3,5}    {4,6}    {3,7}
                          {4,5}    {5,6}    {4,7}
                          {1,3,5}  {1,4,6}  {5,7}
                          {3,4,5}  {2,5,6}  {6,7}
                                   {4,5,6}  {1,3,7}
                                            {1,4,7}
                                            {1,5,7}
                                            {2,3,7}
                                            {2,6,7}
                                            {3,5,7}
                                            {4,5,7}
                                            {4,6,7}
                                            {5,6,7}
                                            {1,3,5,7}
                                            {4,5,6,7}
(End)
		

Crossrefs

Cf. A007865.
For non-binary sum-free subsets of {1..n} we have A237667.
For sum-free partitions we have A364345, without re-using parts A236912.
Without re-using parts we have A364755, diffs of A085489 (non-bin A151897).
The complement without re-using parts is A364756, differences of A088809.

Programs

  • Mathematica
    Table[Length[Select[Subsets[Range[n]],MemberQ[#,n]&&Intersection[#,Total/@Tuples[#,2]]=={}&]],{n,10}] (* Gus Wiseman, Aug 12 2023 *)

Formula

a(n) = A007865(n) - A007865(n-1).

A288887 Triangle read by rows: T(n,k) is the number of times k is a member of a sum-free subset of {1, ..., n} for 1 <= k <= n.

Original entry on oeis.org

1, 1, 1, 2, 2, 3, 3, 2, 4, 3, 5, 3, 7, 5, 7, 7, 5, 7, 8, 10, 8, 12, 8, 12, 13, 17, 13, 18, 16, 13, 17, 13, 23, 18, 25, 19, 28, 21, 30, 21, 40, 32, 43, 32, 47, 37, 29, 40, 29, 40, 45, 57, 45, 63, 43, 62, 44, 66, 45, 65, 72, 95, 71, 104, 70, 102, 85, 66, 95, 71, 89, 72, 132, 109, 139, 104, 142, 116
Offset: 1

Author

Ben Burns, Jun 18 2017

Keywords

Examples

			For the nine sum-free subsets of {1,2,3,4}, 1 is a member of three of them, 2 is a member of two, 3 is a member of four, and 4 is a member of three, hence the 4th row is 3,2,4,3.
The triangle begins:
   1;
   1,  1;
   2,  2,  3;
   3,  2,  4,  3;
   5,  3,  7,  5,  7;
   7,  5,  7,  8, 10,  8;
  12,  8, 12, 13, 17, 13, 18;
  16, 13, 17, 13, 23, 18, 25, 19;
  ...
		

Crossrefs

Cf. A007865, A288888 (row sums).

Programs

  • PARI
    sumfree(v) = {for(i=1, #v, for (j=1, i, if (setsearch(v, v[i]+v[j]), return (0)););); return (1);}
    row(n) = {my(v = vector(n)); forsubset(n, s, if (sumfree(Set(s)), for (k=1, n, if (setsearch(Set(s), k), v[k]++);););); v;} \\ Michel Marcus, Nov 08 2020

A288817 Number of set partitions of [n] such that each subset is sum-free.

Original entry on oeis.org

1, 1, 1, 3, 6, 20, 67, 291, 1099, 5780, 26249, 153238, 832366, 5443440, 32738738, 239515824, 1591963864, 12548347149, 93066370414
Offset: 0

Author

Ben Burns, Jun 17 2017

Keywords

Comments

The count can be built constructively by listing all possible sum-free sets of partitions into collections containing {1, ..., n}. For n>1, iterate over the previous generation and insert n into each partition if the result is sum-free, and also append n to the end as its own partition. See Example.

Examples

			Where "|" is a partition divider, then:
a(1)=1, given by { 1 }.
a(2)=1, given by { 1|2 }.
a(3)=3, given by { 1,3|2 }, { 1|2,3 }, { 1|2|3 }.
a(4)=6, given by { 1,3|2|4 }, { 1,4|2,3 }, { 1|2,3|4 }, { 1,4|2|3 }, { 1|2|3,4 }, { 1|2|3|4 }.
		

Crossrefs

A245390 Number of ways to build an expression using non-redundant parentheses in an expression of n variables, counted in decreasing sub-partitions of equal size.

Original entry on oeis.org

1, 1, 3, 11, 39, 145, 514, 1901, 6741, 24880, 87791, 325634, 1152725, 4251234, 15052387, 55750323, 197031808, 729360141, 2579285955, 9539017676, 33822222227, 124889799518, 440743675148, 1635528366655, 5790967247863, 21360573026444, 75643815954959, 280096917425535
Offset: 1

Author

Ben Burns, Jul 22 2014

Keywords

Comments

Expressions contain only binary operators. Parentheses around a single variable or the entire expression are considered redundant or unnecessary.
If the number of partitions (parenthetical group) does not evenly divide the number of variables, combinations of remaining variables are counted but not divided into sub-partitions.

Examples

			For n=3, the a(3)=3 different possibilities are
1)  x+x+x,
2)  (x+x)+x,
3)  x+(x+x).
For n=4, the a(4)=11 different possibilities are
1)  x+x+x+x,
2)  (x+x+x)+x,
3)  ((x+x)+x)+x,
4)  (x+(x+x))+x,
5)  x+(x+x+x),
6)  x+((x+x)+x),
7)  x+(x+(x+x)),
8)  (x+x)+x+x,
9)  x+(x+x)+x,
10) x+x+(x+x),
11) (x+x)+(x+x).
For n=5, a(5)=39 is the first time this sequence differs from A001003. The combinations for (x+x+x)+(x+x) and (x+x)+(x+x+x) are not counted as these two partitions are not of equal size.
		

Crossrefs

Programs

  • Python
    from functools import reduce
    import math
    import operator as op
    def binom(n, r):
        r = min(r, n-r)
        if r == 0: return 1
        numer = reduce(op.mul, range(n, n-r, -1))
        denom = reduce(op.mul, range(1, r+1))
        return numer//denom
    max = 100
    seq = [0,1,1]
    for n in range(3, max) :
        sum = 0
        for choose in range(2, n+1):
            f = math.ceil(n/choose)
            f+=1
            for times in range(1, int(f)) :
                if choose*times > n :
                    continue
                if choose==n and times==1 :
                    sum += 1
                else :
                    sum += binom(n - (choose*times) + times, times) * (seq[choose]**times)
        seq.append(sum)
    for (i, x) in enumerate(seq) :
        if i==0:
            continue
        print(i, x)