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.

Showing 1-10 of 122 results. Next

A108917 Number of knapsack partitions of n.

Original entry on oeis.org

1, 1, 2, 3, 4, 6, 7, 11, 12, 17, 19, 29, 25, 41, 41, 58, 56, 84, 75, 117, 99, 149, 140, 211, 172, 259, 237, 334, 292, 434, 348, 547, 465, 664, 588, 836, 681, 1014, 873, 1243, 1039, 1502, 1224, 1822, 1507, 2094, 1810, 2605, 2118, 3038, 2516
Offset: 0

Views

Author

Richard Ehrenborg, Jul 20 2005

Keywords

Comments

A knapsack partition is a partition such that for every integer there is at most one way to write it as a sum of a subset of the parts of the partition.
Equivalently, a knapsack partition of n is a multiset of positive integers summing to n such that every distinct submultiset has a different sum. - Gus Wiseman, Oct 03 2015

Examples

			a(4) = 4, since there are 5 partitions of 4 (see sequence A000041) and the partition 211 is the only partition of these that is not knapsack since 2=1+1.
The a(5) = 6 knapsack partitions of 5 are {{5},{3,2},{4,1},{2,2,1},{3,1,1},{1,1,1,1,1}}.
		

Crossrefs

Cf. A000041, A275972 (strict knapsack partitions).

Programs

  • Maple
    g:= proc(n, k) option remember;
    # list of pairs [multiset, generator] of knapsack partitions of n with max part k
    local res, i,p,p2;
    if k = 1 then return [[[n],add(x^i,i=0..n)]] fi;
    res:= NULL;
    for i from 0 to floor(n/k) do
      for p in procname(n-k*i,k-1) do
         p2:= p[2]*add(x^(k*j),j=0..i);
         if max(coeffs(expand(p2))) <= 1 then
            res:= res, [[op(p[1]),i],p2]
         fi
      od
    od;
    [res];
    end proc:
    1, seq(nops(g(n,n)), n=1..60); # Robert Israel, Oct 04 2015
  • Mathematica
    ksQ[ptn_] := UnsameQ @@ Plus @@@ Union[Subsets[ptn]];
    ksAll[n_Integer] :=
      ksAll[n] =
       If[n <= 0, {},
        With[{loe = Array[ksAll, n - 1, 1, Join]},
         Union[{{n}},
          Select[Sort[Append[#, n - Plus @@ #], Greater] & /@ loe, ksQ]]]];
    ksAll[5](*example*)
    Array[Length[ksAll[#]] &, 20](*sequence*) (* Gus Wiseman, Oct 02 2015 *)

A299702 Heinz numbers of knapsack partitions.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 31, 32, 33, 34, 35, 37, 38, 39, 41, 42, 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 61, 62, 64, 65, 66, 67, 68, 69, 71, 73, 74, 75, 76, 77, 78
Offset: 1

Views

Author

Gus Wiseman, Feb 17 2018

Keywords

Comments

An integer partition is knapsack if every distinct submultiset has a different sum. The Heinz number of an integer partition (y_1,...,y_k) is prime(y_1)*...*prime(y_k).

Crossrefs

Programs

  • Maple
    filter:= proc(n) local F,t,S,i,r;
      F:= map(t -> [numtheory:-pi(t[1]),t[2]], ifactors(n)[2]);
      S:= {0}: r:= 1;
      for t in F do
       S:= map(s -> seq(s + i*t[1],i=0..t[2]),S);
       r:= r*(t[2]+1);
       if nops(S) <> r then return false fi
      od;
      true
    end proc:
    select(filter, [$1..100]); # Robert Israel, Oct 30 2024
  • Mathematica
    primeMS[n_]:=If[n===1,{},Flatten[Cases[FactorInteger[n],{p_,k_}:>Table[PrimePi[p],{k}]]]];
    Select[Range[100],UnsameQ@@Plus@@@Union[Rest@Subsets[primeMS[#]]]&]

A364350 Number of strict integer partitions of n such that no part can be written as a nonnegative linear combination of the others.

Original entry on oeis.org

1, 1, 1, 1, 1, 2, 1, 3, 2, 3, 3, 5, 3, 6, 5, 7, 6, 9, 7, 11, 10, 14, 12, 16, 15, 20, 17, 24, 22, 27, 29, 32, 30, 41, 36, 49, 45, 50, 52, 65, 63, 70, 77, 80, 83, 104, 98, 107, 116, 126, 134, 152, 148, 162, 180, 196, 195, 227, 227, 238, 272, 271, 293, 333, 325
Offset: 0

Views

Author

Gus Wiseman, Aug 15 2023

Keywords

Comments

A way of writing n as a (presumed nonnegative) linear combination of a finite sequence y is any sequence of pairs (k_i,y_i) such that k_i >= 0 and Sum k_i*y_i = n. For example, the pairs ((3,1),(1,1),(1,1),(0,2)) are a way of writing 5 as a linear combination of (1,1,1,2), namely 5 = 3*1 + 1*1 + 1*1 + 0*2. Of course, there are A000041(n) ways to write n as a linear combination of (1..n).

Examples

			The a(16) = 6 through a(22) = 12 strict partitions:
  (16)     (17)     (18)     (19)     (20)      (21)      (22)
  (9,7)    (9,8)    (10,8)   (10,9)   (11,9)    (12,9)    (13,9)
  (10,6)   (10,7)   (11,7)   (11,8)   (12,8)    (13,8)    (14,8)
  (11,5)   (11,6)   (13,5)   (12,7)   (13,7)    (15,6)    (15,7)
  (13,3)   (12,5)   (14,4)   (13,6)   (14,6)    (16,5)    (16,6)
  (7,5,4)  (13,4)   (7,6,5)  (14,5)   (17,3)    (17,4)    (17,5)
           (14,3)   (8,7,3)  (15,4)   (8,7,5)   (19,2)    (18,4)
           (15,2)            (16,3)   (9,6,5)   (11,10)   (19,3)
           (7,6,4)           (17,2)   (9,7,4)   (8,7,6)   (12,10)
                             (8,6,5)  (11,5,4)  (9,7,5)   (9,7,6)
                             (9,6,4)            (10,7,4)  (9,8,5)
                                                (10,8,3)  (7,6,5,4)
                                                (11,6,4)
                                                (11,7,3)
		

Crossrefs

For sums of subsets instead of combinations of partitions we have A151897.
For sums instead of combinations we have A237667, binary A236912.
For subsets instead of partitions we have A326083, complement A364914.
The complement in strict partitions is A364839, non-strict A364913.
A more strict variation is A364915.
The case of all positive coefficients is A365006.
A000041 counts integer partitions, strict A000009.
A008284 counts partitions by length, strict A008289.
A108917 counts knapsack partitions, ranks A299702.
A116861 and A364916 count linear combinations of strict partitions.
A323092 (ranks A320340) and A120641 count double-free partitions.
A364912 counts linear combinations of partitions of k.

Programs

  • Mathematica
    combs[n_,y_]:=With[{s=Table[{k,i},{k,y},{i,0,Floor[n/k]}]},Select[Tuples[s],Total[Times@@@#]==n&]];
    Table[Length[Select[IntegerPartitions[n],UnsameQ@@#&&And@@Table[combs[#[[k]],Delete[#,k]]=={},{k,Length[#]}]&]],{n,0,15}]
  • Python
    from sympy.utilities.iterables import partitions
    def A364350(n):
        if n <= 1: return 1
        alist, c = [set(tuple(sorted(set(p))) for p in partitions(i)) for i in range(n)], 1
        for p in partitions(n,k=n-1):
            if max(p.values(),default=0)==1:
                s = set(p)
                if not any(set(t).issubset(s-{q}) for q in s for t in alist[q]):
                    c += 1
        return c # Chai Wah Wu, Sep 23 2023

Extensions

More terms and offset corrected by Martin Fuller, Sep 11 2023

A364272 Number of strict integer partitions of n containing the sum of some subset of the parts. A variation of sum-full strict partitions.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 3, 1, 4, 3, 8, 6, 11, 10, 17, 16, 26, 25, 39, 39, 54, 60, 82, 84, 116, 126, 160, 177, 222, 242, 302, 337, 402, 453, 542, 601, 722, 803, 936, 1057, 1234, 1373, 1601, 1793, 2056, 2312, 2658, 2950, 3395, 3789, 4281, 4814, 5452, 6048
Offset: 0

Views

Author

Gus Wiseman, Aug 01 2023

Keywords

Comments

First differs from A316402 at a(16) = 11 due to (7,5,3,1).

Examples

			The a(6) = 1 through a(16) = 11 partitions (A=10):
  (321) . (431) . (532)  (5321) (642)  (5431) (743)  (6432)  (853)
                  (541)         (651)  (6421) (752)  (6531)  (862)
                  (4321)        (5421) (7321) (761)  (7431)  (871)
                                (6321)        (5432) (7521)  (6532)
                                              (6431) (9321)  (6541)
                                              (6521) (54321) (7432)
                                              (7421)         (7621)
                                              (8321)         (8431)
                                                             (8521)
                                                             (A321)
                                                             (64321)
		

Crossrefs

The non-strict complement is A237667, ranks A364531.
The non-strict version is A237668, ranks A364532.
The complement in strict partitions is A364349, binary A364533.
The linear combination-free version is A364350.
For subsets of {1..n} we have A364534, complement A151897.
The binary version is A364670, allowing re-used parts A363226.
A000041 counts integer partitions, strict A000009.
A008284 counts partitions by length, strict A008289.
A108917 counts knapsack partitions, strict A275972, ranks A299702.
A236912 counts binary sum-free partitions, complement A237113.
A323092 counts double-free partitions, ranks A320340.

Programs

  • Mathematica
    Table[Length[Select[IntegerPartitions[n], UnsameQ@@#&&Intersection[#, Total/@Subsets[#,{2,Length[#]}]]!={}&]],{n,0,30}]

A236912 Number of partitions of n such that no part is a sum of two other parts.

Original entry on oeis.org

1, 1, 2, 3, 4, 6, 8, 12, 14, 20, 25, 34, 40, 54, 64, 85, 98, 127, 149, 189, 219, 277, 316, 395, 456, 557, 638, 778, 889, 1070, 1226, 1461, 1667, 1978, 2250, 2645, 3019, 3521, 3997, 4652, 5267, 6093, 6909, 7943, 8982, 10291, 11609, 13251, 14947, 16984, 19104
Offset: 0

Views

Author

Clark Kimberling, Feb 01 2014

Keywords

Comments

These are partitions containing the sum of no 2-element submultiset of the parts, a variation of binary sum-free partitions where parts cannot be re-used, ranked by A364461. The complement is counted by A237113. The non-binary version is A237667. For re-usable parts we have A364345. - Gus Wiseman, Aug 09 2023

Examples

			Of the 11 partitions of 6, only these 3 include a part that is a sum of two other parts: [3,2,1], [2,2,1,1], [2,1,1,1,1].  Thus, a(6) = 11 - 3 = 8.
From _Gus Wiseman_, Aug 09 2023: (Start)
The a(1) = 1 through a(8) = 14 partitions:
  (1)  (2)   (3)    (4)     (5)      (6)       (7)        (8)
       (11)  (21)   (22)    (32)     (33)      (43)       (44)
             (111)  (31)    (41)     (42)      (52)       (53)
                    (1111)  (221)    (51)      (61)       (62)
                            (311)    (222)     (322)      (71)
                            (11111)  (411)     (331)      (332)
                                     (3111)    (421)      (521)
                                     (111111)  (511)      (611)
                                               (2221)     (2222)
                                               (4111)     (3311)
                                               (31111)    (5111)
                                               (1111111)  (41111)
                                                          (311111)
                                                          (11111111)
(End)
		

Crossrefs

For subsets of {1..n} we have A085489, complement A088809.
The complement is counted by A237113, ranks A364462.
The non-binary version is A237667, ranks A364531.
The non-binary complement is A237668, ranks A364532.
The version with re-usable parts is A364345, ranks A364347.
The (strict) version for linear combinations of parts is A364350.
These partitions have ranks A364461.
The strict case is A364533, non-binary A364349.
The strict complement is A364670, with re-usable parts A363226.
A000041 counts partitions, strict A000009.
A008284 counts partitions by length, strict A008289.
A108917 counts knapsack partitions, ranks A299702.
A323092 counts double-free partitions, ranks A320340.

Programs

  • Mathematica
    z = 20; t = Map[Count[Map[Length[Cases[Map[Total[#] &, Subsets[#, {2}]],  Apply[Alternatives, #]]] &, IntegerPartitions[#]], 0] &, Range[z]] (* A236912 *)
    u = PartitionsP[Range[z]] - t  (* A237113, Peter J. C. Moses, Feb 03 2014 *)
    Table[Length[Select[IntegerPartitions[n],Intersection[#,Total/@Subsets[#,{2}]]=={}&]],{n,0,15}] (* Gus Wiseman, Aug 09 2023 *)

Formula

a(n) = A000041(n) - A237113(n).

Extensions

a(0)=1 prepended by Alois P. Heinz, Sep 17 2023

A284640 Number of positive subset sums of strict integer partitions of n.

Original entry on oeis.org

1, 1, 4, 4, 7, 13, 17, 23, 34, 49, 62, 87, 112, 149, 199, 249, 318, 408, 512, 635, 820, 991, 1238, 1515, 1864, 2248, 2770, 3326, 4030, 4818, 5808, 6882, 8290, 9756, 11639, 13719, 16236, 18999, 22468, 26144, 30724, 35761, 41754, 48357, 56380, 65018, 75438
Offset: 1

Views

Author

Gus Wiseman, Mar 31 2017

Keywords

Comments

For a strict integer partition p summing to n, a pair (t,p) is defined to be a positive subset sum if there exists a nonempty subset of p summing to t.

Examples

			The a(6)=13 subset sums are:
(6,6),
(1,51), (5,51), (6,51),
(2,42), (4,42), (6,42),
(1,321), (2,321), (3,321), (4,321), (5,321), (6,321).
		

Crossrefs

Programs

  • Mathematica
    nn=25;Total/@Table[Function[ptn,Length[Union[Total/@Rest[Subsets[ptn]]]]]/@Select[IntegerPartitions[n],UnsameQ@@#&],{n,nn}]

A364534 Number of subsets of {1..n} containing some element equal to the sum of two or more distinct other elements. A variation of sum-full subsets without re-used elements.

Original entry on oeis.org

0, 0, 0, 1, 3, 10, 27, 68, 156, 357, 775, 1667, 3505, 7303, 15019, 30759, 62489, 126619, 255542, 514721, 1034425, 2076924, 4164650, 8346306, 16715847, 33467324, 66982798, 134040148, 268179417, 536510608, 1073226084, 2146759579, 4293930436, 8588485846, 17177799658
Offset: 0

Views

Author

Gus Wiseman, Aug 02 2023

Keywords

Examples

			The a(0) = 0 through a(5) = 10 subsets:
  .  .  .  {1,2,3}  {1,2,3}    {1,2,3}
                    {1,3,4}    {1,3,4}
                    {1,2,3,4}  {1,4,5}
                               {2,3,5}
                               {1,2,3,4}
                               {1,2,3,5}
                               {1,2,4,5}
                               {1,3,4,5}
                               {2,3,4,5}
                               {1,2,3,4,5}
		

Crossrefs

The binary version is A088809, complement A085489.
The complement is counted by A151897.
The complement for partitions is A237667, ranks A364531.
For partitions we have A237668, ranks A364532.
For strict partitions we have A364272, complement A364349.
A108917 counts knapsack partitions, strict A275972.
A236912 counts sum-free partitions w/o re-used parts, complement A237113.

Programs

  • Mathematica
    Table[Length[Select[Subsets[Range[n]],Intersection[#,Total/@Subsets[#,{2,Length[#]}]]!={}&]],{n,0,10}]

Formula

a(n) = 2^n - A151897(n). - Andrew Howroyd, Jan 27 2024

Extensions

a(16)-a(25) from Chai Wah Wu, Nov 14 2023
a(26) onwards (using A151897) added by Andrew Howroyd, Jan 27 2024

A364839 Number of strict integer partitions of n such that some part can be written as a nonnegative linear combination of the others.

Original entry on oeis.org

0, 0, 0, 1, 1, 1, 3, 2, 4, 5, 7, 7, 12, 12, 17, 20, 26, 29, 39, 43, 54, 62, 77, 88, 107, 122, 148, 168, 200, 229, 267, 308, 360, 407, 476, 536, 623, 710, 812, 917, 1050, 1190, 1349, 1530, 1733, 1944, 2206, 2483, 2794, 3138, 3524
Offset: 0

Views

Author

Gus Wiseman, Aug 19 2023

Keywords

Examples

			For y = (4,3,2) we can write 4 = 0*3 + 2*2, so y is counted under a(9).
For y = (11,5,3) we can write 11 = 1*5 + 2*3, so y is counted under a(19).
For y = (17,5,4,3) we can write 17 = 1*3 + 1*4 + 2*5, so y is counted under a(29).
The a(1) = 0 through a(12) = 12 strict partitions (A = 10, B = 11):
  .  .  (21)  (31)  (41)  (42)   (61)   (62)   (63)   (82)    (A1)    (84)
                          (51)   (421)  (71)   (81)   (91)    (542)   (93)
                          (321)         (431)  (432)  (532)   (632)   (A2)
                                        (521)  (531)  (541)   (641)   (B1)
                                               (621)  (631)   (731)   (642)
                                                      (721)   (821)   (651)
                                                      (4321)  (5321)  (732)
                                                                      (741)
                                                                      (831)
                                                                      (921)
                                                                      (5421)
                                                                      (6321)
		

Crossrefs

For sums instead of combinations we have A364272, binary A364670.
The complement in strict partitions is A364350.
Non-strict versions are A364913 and the complement of A364915.
For subsets instead of partitions we have A364914, complement A326083.
The case of no all positive coefficients is A365006.
A000041 counts integer partitions, strict A000009.
A008284 counts partitions by length, strict A008289.
A116861 and A364916 count linear combinations of strict partitions.

Programs

  • Mathematica
    combs[n_,y_]:=With[{s=Table[{k,i},{k,y}, {i,0,Floor[n/k]}]}, Select[Tuples[s], Total[Times@@@#]==n&]];
    Table[Length[Select[IntegerPartitions[n], UnsameQ@@#&&Or@@Table[combs[#[[k]], Delete[#,k]]!={}, {k,Length[#]}]&]],{n,0,15}]
  • Python
    from sympy.utilities.iterables import partitions
    def A364839(n):
        if n <= 1: return 0
        alist, c = [set(tuple(sorted(set(p))) for p in partitions(i)) for i in range(n)], 0
        for p in partitions(n,k=n-1):
            if max(p.values(),default=0)==1:
                s = set(p)
                if any(set(t).issubset(s-{q}) for q in s for t in alist[q]):
                    c += 1
        return c # Chai Wah Wu, Sep 23 2023

A365661 Triangle read by rows where T(n,k) is the number of strict integer partitions of n with a submultiset summing to k.

Original entry on oeis.org

1, 1, 1, 1, 0, 1, 2, 1, 1, 2, 2, 1, 0, 1, 2, 3, 1, 1, 1, 1, 3, 4, 2, 2, 1, 2, 2, 4, 5, 2, 2, 2, 2, 2, 2, 5, 6, 3, 2, 3, 1, 3, 2, 3, 6, 8, 3, 3, 4, 3, 3, 4, 3, 3, 8, 10, 5, 4, 5, 4, 3, 4, 5, 4, 5, 10, 12, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 12
Offset: 0

Views

Author

Gus Wiseman, Sep 16 2023

Keywords

Comments

First differs from A284593 at T(6,3) = 1, A284593(6,3) = 2.
Rows are palindromic.
Are there only two zeros in the whole triangle?

Examples

			Triangle begins:
  1
  1  1
  1  0  1
  2  1  1  2
  2  1  0  1  2
  3  1  1  1  1  3
  4  2  2  1  2  2  4
  5  2  2  2  2  2  2  5
  6  3  2  3  1  3  2  3  6
  8  3  3  4  3  3  4  3  3  8
Row n = 6 counts the following strict partitions:
  (6)      (5,1)    (4,2)    (3,2,1)  (4,2)    (5,1)    (6)
  (5,1)    (3,2,1)  (3,2,1)           (3,2,1)  (3,2,1)  (5,1)
  (4,2)                                                 (4,2)
  (3,2,1)                                               (3,2,1)
Row n = 10 counts the following strict partitions:
  A     91    82    73    64    532   64    73    82    91    A
  64    541   532   532   541   541   541   532   532   541   64
  73    631   721   631   631   4321  631   631   721   631   73
  82    721   4321  721   4321        4321  721   4321  721   82
  91    4321        4321                    4321        4321  91
  532                                                         532
  541                                                         541
  631                                                         631
  721                                                         721
  4321                                                        4321
		

Crossrefs

Columns k = 0 and k = n are A000009.
The non-strict complement is A046663, central column A006827.
Central column n = 2k is A237258.
For subsets instead of partitions we have A365381.
The non-strict case is A365543.
The complement is A365663.
A000124 counts distinct possible sums of subsets of {1..n}.
A364272 counts sum-full strict partitions, sum-free A364349.

Programs

  • Mathematica
    Table[Length[Select[Select[IntegerPartitions[n], UnsameQ@@#&], MemberQ[Total/@Subsets[#],k]&]], {n,0,10},{k,0,n}]

A365663 Triangle read by rows where T(n,k) is the number of strict integer partitions of n without a subset summing to k.

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 2, 2, 2, 2, 2, 2, 3, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 3, 5, 3, 4, 3, 5, 5, 4, 5, 5, 4, 5, 5, 5, 6, 5, 6, 7, 6, 5, 6, 5, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 9, 8, 8, 8, 11, 8, 8, 8, 9, 8, 10, 11, 10, 10, 10, 10, 10, 10, 10, 10, 11, 10, 12, 13, 11, 13, 11, 12, 15, 12, 11, 13, 11, 13, 12
Offset: 2

Views

Author

Gus Wiseman, Sep 17 2023

Keywords

Comments

Warning: Do not confuse with the non-strict version A046663.
Rows are palindromes.

Examples

			Triangle begins:
  1
  1  1
  1  2  1
  2  2  2  2
  2  2  3  2  2
  3  3  3  3  3  3
  3  4  3  5  3  4  3
  5  5  4  5  5  4  5  5
  5  6  5  6  7  6  5  6  5
  7  7  7  7  7  7  7  7  7  7
  8  9  8  8  8 11  8  8  8  9  8
Row n = 8 counts the following strict partitions:
  (8)    (8)      (8)    (8)      (8)    (8)      (8)
  (6,2)  (7,1)    (7,1)  (7,1)    (7,1)  (7,1)    (6,2)
  (5,3)  (5,3)    (6,2)  (6,2)    (6,2)  (5,3)    (5,3)
         (4,3,1)         (5,3)           (4,3,1)
                         (5,2,1)
		

Crossrefs

Columns k = 0 and k = n are A025147.
The non-strict version is A046663, central column A006827.
Central column n = 2k is A321142.
The complement for subsets instead of strict partitions is A365381.
The complement is A365661, non-strict A365543, central column A237258.
Row sums are A365922.
A000009 counts subsets summing to n.
A000124 counts distinct possible sums of subsets of {1..n}.
A124506 appears to count combination-free subsets, differences of A326083.
A364272 counts sum-full strict partitions, sum-free A364349.
A364350 counts combination-free strict partitions, complement A364839.

Programs

  • Mathematica
    Table[Length[Select[IntegerPartitions[n], UnsameQ@@#&&FreeQ[Total/@Subsets[#],k]&]], {n,2,15},{k,1,n-1}]
Showing 1-10 of 122 results. Next