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-8 of 8 results.

A304792 Number of subset-sums of integer partitions of n.

Original entry on oeis.org

1, 2, 5, 10, 19, 34, 58, 96, 152, 240, 361, 548, 795, 1164, 1647, 2354, 3243, 4534, 6150, 8420, 11240, 15156, 19938, 26514, 34513, 45260, 58298, 75704, 96515, 124064, 157072, 199894, 251097, 317278, 395625, 496184, 615229, 765836, 944045, 1168792, 1432439
Offset: 0

Views

Author

Gus Wiseman, May 18 2018

Keywords

Comments

For a multiset p of positive integers summing to n, a pair (t,p) is defined to be a subset sum if there exists a submultiset of p summing to t. This sequence is dominated by A122768 + A000041 (number of submultisets of integer partitions of n).

Examples

			The a(4)=19 subset sums are (0,4), (4,4), (0,31), (1,31), (3,31), (4,31), (0,22), (2,22), (4,22), (0,211), (1,211), (2,211), (3,211), (4,211), (0,1111), (1,1111), (2,1111), (3,1111), (4,1111).
		

Crossrefs

Programs

  • Maple
    b:= proc(n, i, s) option remember; `if`(n=0, nops(s),
         `if`(i<1, 0, b(n, i-1, s)+b(n-i, min(n-i, i),
          map(x-> [x, x+i][], s))))
        end:
    a:= n-> b(n$2, {0}):
    seq(a(n), n=0..40);  # Alois P. Heinz, May 18 2018
  • Mathematica
    Table[Total[Length[Union[Total/@Subsets[#]]]&/@IntegerPartitions[n]],{n,15}]
    (* Second program: *)
    b[n_, i_, s_] := b[n, i, s] = If[n == 0, Length[s],
         If[i < 1, 0, b[n, i - 1, s] + b[n - i, Min[n - i, i],
         {#, # + i}& /@ s // Flatten // Union]]];
    a[n_] := b[n, n, {0}];
    a /@ Range[0, 40] (* Jean-François Alcover, May 20 2021, after Alois P. Heinz *)
  • Python
    from functools import lru_cache
    @lru_cache(maxsize=None)
    def A304792_T(n,i,s,l):
        if n==0: return l
        if i<1: return 0
        return A304792_T(n,i-1,s,l)+A304792_T(n-i,min(n-i,i),(t:=tuple(sorted(set(s+tuple(x+i for x in s))))),len(t))
    def A304792(n): return A304792_T(n,n,(0,),1) # Chai Wah Wu, Sep 25 2023, after Alois P. Heinz

Formula

a(n) = A276024(n) + A000041(n).

A301957 Number of distinct subset-products of the integer partition with Heinz number n.

Original entry on oeis.org

1, 1, 2, 1, 2, 2, 2, 1, 3, 2, 2, 2, 2, 2, 4, 1, 2, 3, 2, 2, 4, 2, 2, 2, 3, 2, 4, 2, 2, 4, 2, 1, 4, 2, 4, 3, 2, 2, 4, 2, 2, 4, 2, 2, 6, 2, 2, 2, 3, 3, 4, 2, 2, 4, 4, 2, 4, 2, 2, 4, 2, 2, 5, 1, 4, 4, 2, 2, 4, 4, 2, 3, 2, 2, 6, 2, 4, 4, 2, 2, 5, 2, 2, 4, 4, 2, 4, 2, 2, 6, 4, 2, 4, 2, 4, 2, 2, 3, 6, 3, 2, 4, 2, 2, 8
Offset: 1

Views

Author

Gus Wiseman, Mar 29 2018

Keywords

Comments

A subset-product of an integer partition y is a product of some submultiset of y. The Heinz number of an integer partition (y_1,...,y_k) is prime(y_1)*...*prime(y_k).
Number of distinct values obtained when A003963 is applied to all divisors of n. - Antti Karttunen, Sep 05 2018

Examples

			The distinct subset-products of (4,2,1,1) are 1, 2, 4, and 8, so a(84) = 4.
The distinct subset-products of (6,3,2) are 1, 2, 3, 6, 12, 18, and 36, so a(195) = 7.
		

Crossrefs

Programs

  • Mathematica
    Table[If[n===1,1,Length[Union[Times@@@Subsets[Join@@Cases[FactorInteger[n],{p_,k_}:>Table[PrimePi[p],{k}]]]]]],{n,100}]
  • PARI
    up_to = 65537;
    A003963(n) = { n=factor(n); n[, 1]=apply(primepi, n[, 1]); factorback(n) }; \\ From A003963
    v003963 = vector(up_to,n,A003963(n));
    A301957(n) = { my(m=Map(),s,k=0,c); fordiv(n,d,if(!mapisdefined(m,s = v003963[d],&c), mapput(m,s,s); k++)); (k); }; \\ Antti Karttunen, Sep 05 2018

Extensions

More terms from Antti Karttunen, Sep 05 2018

A301854 Number of positive special sums of integer partitions of n.

Original entry on oeis.org

1, 3, 7, 13, 25, 40, 67, 100, 158, 220, 336, 452, 649, 862, 1228, 1553, 2155, 2738, 3674, 4612, 6124, 7497, 9857, 12118, 15524, 18821, 24152, 28863, 36549, 44002, 54576, 65125, 80943, 95470, 117991, 139382, 169389, 199144, 242925, 283353, 342139, 400701, 479001
Offset: 1

Views

Author

Gus Wiseman, Mar 27 2018

Keywords

Comments

A positive special sum of an integer partition y is a number n > 0 such that exactly one submultiset of y sums to n.

Examples

			The a(4) = 13 special positive subset-sums:
1<=(1111), 2<=(1111), 3<=(1111), 4<=(1111),
1<=(211),  3<=(211),  4<=(211),
1<=(31),   3<=(31),   4<=(31),
2<=(22),   4<=(22),
4<=(4).
		

Crossrefs

Programs

  • Mathematica
    uqsubs[y_]:=Join@@Select[GatherBy[Union[Rest[Subsets[y]]],Total],Length[#]===1&];
    Table[Total[Length/@uqsubs/@IntegerPartitions[n]],{n,25}]
  • Python
    from collections import Counter
    from sympy.utilities.iterables import partitions, multiset_combinations
    def A301854(n): return sum(sum(1 for r in Counter(sum(q) for l in range(1,len(p)+1) for q in multiset_combinations(p,l)).values() if r==1) for p in (tuple(Counter(x).elements()) for x in partitions(n))) # Chai Wah Wu, Sep 26 2023

Extensions

a(21)-a(35) from Alois P. Heinz, Apr 08 2018
a(36)-a(43) from Chai Wah Wu, Sep 26 2023

A301855 Number of divisors d|n such that no other divisor of n has the same Heinz weight A056239(d).

Original entry on oeis.org

1, 2, 2, 3, 2, 4, 2, 4, 3, 4, 2, 4, 2, 4, 4, 5, 2, 6, 2, 6, 4, 4, 2, 4, 3, 4, 4, 6, 2, 6, 2, 6, 4, 4, 4, 5, 2, 4, 4, 6, 2, 8, 2, 6, 6, 4, 2, 4, 3, 6, 4, 6, 2, 8, 4, 8, 4, 4, 2, 4, 2, 4, 4, 7, 4, 8, 2, 6, 4, 6, 2, 4, 2, 4, 6, 6, 4, 8, 2, 6, 5, 4, 2, 6, 4, 4, 4, 8, 2, 6, 4, 6, 4, 4, 4, 4, 2, 6, 6, 9, 2, 8, 2, 8, 8
Offset: 1

Views

Author

Gus Wiseman, Mar 27 2018

Keywords

Examples

			The a(24) = 4 special divisors are 1, 2, 12, 24.
		

Crossrefs

Programs

  • Mathematica
    primeMS[n_]:=If[n===1,{},Flatten[Cases[FactorInteger[n],{p_,k_}:>Table[PrimePi[p],{k}]]]];
    uqsubs[y_]:=Join@@Select[GatherBy[Union[Subsets[y]],Total],Length[#]===1&];
    Table[Length[uqsubs[primeMS[n]]],{n,100}]
  • PARI
    A056239(n) = { my(f); if(1==n, 0, f=factor(n); sum(i=1, #f~, f[i,2] * primepi(f[i,1]))); }
    A301855(n) = if(1==n,n,my(m=Map(),w,s); fordiv(n,d,w = A056239(d); if(!mapisdefined(m, w, &s), mapput(m,w,Set([d])), mapput(m,w,setunion(Set([d]),s)))); sumdiv(n,d,(1==length(mapget(m,A056239(d)))))); \\ Antti Karttunen, Jul 01 2018

Extensions

More terms from Antti Karttunen, Jul 01 2018

A301935 Number of positive subset-sum trees whose composite a positive subset-sum of the integer partition with Heinz number n.

Original entry on oeis.org

0, 1, 1, 2, 1, 3, 1, 10, 2, 3, 1, 21, 1, 3, 3, 58, 1, 21, 1, 21, 3, 3, 1, 164, 2, 3, 10, 21, 1, 34, 1, 373, 3, 3, 3, 218, 1, 3, 3, 161, 1, 7, 1, 5, 5, 3, 1, 1320, 2, 5, 3, 5, 1, 7, 3, 7, 3, 3, 1, 7, 1, 3, 4, 2558, 3, 7, 1, 5, 3, 6, 1, 7
Offset: 1

Views

Author

Gus Wiseman, Mar 28 2018

Keywords

Comments

The Heinz number of an integer partition (y_1,...,y_k) is prime(y_1)*...*prime(y_k). A positive subset-sum tree with root x is either the symbol x itself, or is obtained by first choosing a positive subset-sum x <= (y_1,...,y_k) with k > 1 and then choosing a positive subset-sum tree with root y_i for each i = 1...k. The composite of a positive subset-sum tree is the positive subset-sum x <= g where x is the root sum and g is the multiset of leaves. We write positive subset-sum trees in the form rootsum(branch,...,branch). For example, 4(1(1,3),2,2(1,1)) is a positive subset-sum tree with composite 4(1,1,1,2,3) and weight 8.

Crossrefs

A301979 Number of subset-sums minus number of subset-products of the integer partition with Heinz number n.

Original entry on oeis.org

0, 1, 0, 2, 0, 2, 0, 3, 0, 2, 0, 3, 0, 2, 0, 4, 0, 3, 0, 4, 0, 2, 0, 4, 0, 2, 0, 4, 0, 3, 0, 5, 0, 2, 0, 4, 0, 2, 0, 5, 0, 4, 0, 4, 0, 2, 0, 5, 0, 3, 0, 4, 0, 4, 0, 6, 0, 2, 0, 4, 0, 2, 0, 6, 0, 4, 0, 4, 0, 3, 0, 5, 0, 2, 0, 4, 0, 4, 0, 6, 0, 2, 0, 5, 0, 2, 0
Offset: 1

Views

Author

Gus Wiseman, Mar 30 2018

Keywords

Comments

The Heinz number of an integer partition (y_1,...,y_k) is prime(y_1)*...*prime(y_k). A subset-sum (or subset-product) of a multiset y is any number equal to the sum (or product) of some submultiset of y.
First negative entry is a(165) = -1.
This sequence is unbounded above and below.

Examples

			The distinct subset-sums of (4,2,1,1) are 0, 1, 2, 3, 4, 5, 6, 7, 8, while the distinct subset-products are 1, 2, 4, 8, so a(84) = 9 - 4 = 5.
The distinct subset-sums of (5,3,2) are 0, 2, 3, 5, 7, 8, 10, while the distinct subset-products are 1, 2, 3, 5, 6, 10, 15, 30, so a(165) = 7 - 8 = -1.
		

Crossrefs

Programs

  • Mathematica
    Table[With[{ptn=If[n===1,{},Join@@Cases[FactorInteger[n],{p_,k_}:>Table[PrimePi[p],{k}]]]},Length[Union[Plus@@@Subsets[ptn]]]-Length[Union[Times@@@Subsets[ptn]]]],{n,100}]
  • PARI
    A003963(n) = {n=factor(n); n[, 1]=apply(primepi, n[, 1]); factorback(n)};
    A301957(n) = {my(ds = divisors(n)); for(i=1,#ds,ds[i] = A003963(ds[i])); #Set(ds)};
    A056239(n) = if(1==n,0,my(f=factor(n)); sum(i=1, #f~, f[i,2] * primepi(f[i,1])));
    A299701(n) = {my(ds = divisors(n)); for(i=1,#ds,ds[i] = A056239(ds[i])); #Set(ds)};
    A301979(n) = (A299701(n) - A301957(n)); \\ Antti Karttunen, Oct 07 2018

Formula

a(n) = A299701(n) - A301957(n).

A301934 Number of positive subset-sum trees of weight n.

Original entry on oeis.org

1, 3, 14, 85, 586, 4331, 33545, 268521, 2204249
Offset: 1

Views

Author

Gus Wiseman, Mar 28 2018

Keywords

Comments

A positive subset-sum tree with root x is either the symbol x itself, or is obtained by first choosing a positive subset-sum x <= (y_1,...,y_k) with k > 1 and then choosing a positive subset-sum tree with root y_i for each i = 1...k. The weight is the sum of the leaves. We write positive subset-sum trees in the form rootsum(branch,...,branch). For example, 4(1(1,3),2,2(1,1)) is a positive subset-sum tree with composite 4(1,1,1,2,3) and weight 8.

Examples

			The a(3) = 14 positive subset-sum trees:
3           3(1,2)       3(1,1,1)     3(1,2(1,1))
2(1,2)      2(1,1,1)     2(1,1(1,1))  2(1(1,1),1)  2(1,2(1,1))
1(1,2)      1(1,1,1)     1(1,1(1,1))  1(1(1,1),1)  1(1,2(1,1))
		

Crossrefs

A301970 Heinz numbers of integer partitions with more subset-products than subset-sums.

Original entry on oeis.org

165, 273, 325, 351, 495, 525, 561, 595, 675, 741, 765, 819, 825, 931, 1045, 1053, 1155, 1173, 1425, 1485, 1495, 1575, 1625, 1653, 1683, 1771, 1785, 1815, 1911, 2025, 2139, 2145, 2223, 2275, 2277, 2295, 2310, 2415, 2457, 2465, 2475, 2625, 2639, 2695, 2805, 2945
Offset: 1

Views

Author

Gus Wiseman, Mar 29 2018

Keywords

Comments

The Heinz number of an integer partition (y_1,...,y_k) is prime(y_1)*...*prime(y_k). A subset-sum (or subset-product) of a multiset y is any number equal to the sum (or product) of some submultiset of y.
Numbers n such that A301957(n) > A299701(n).

Examples

			Sequence of partitions begins: (532), (642), (633), (6222), (5322), (4332), (752), (743), (33222), (862), (7322), (6422), (5332), (844), (853), (62222), (5432), (972), (8332), (53222), (963), (43322), (6333).
		

Crossrefs

Programs

  • Mathematica
    Select[Range[1000],With[{ptn=If[#===1,{},Join@@Cases[FactorInteger[#],{p_,k_}:>Table[PrimePi[p],{k}]]]},Length[Union[Times@@@Subsets[ptn]]]>Length[Union[Plus@@@Subsets[ptn]]]]&]
Showing 1-8 of 8 results.