[go: up one dir, main page]

login
Search: a294150 -id:a294150
     Sort: relevance | references | number | modified | created      Format: long | short | data
Number of knapsack factorizations whose factors sum to n.
+10
11
1, 1, 1, 2, 2, 4, 4, 6, 8, 11, 12, 19, 21, 27, 34, 45, 51, 69, 77, 100, 117, 146
OFFSET
1,4
COMMENTS
A knapsack factorization is a finite multiset of positive integers greater than one such that every distinct submultiset has a different product.
EXAMPLE
The a(12) = 19 partitions are:
(12),
(10 2), (9 3), (8 4), (7 5), (6 6),
(8 2 2), (7 3 2), (6 4 2), (6 3 3), (5 5 2), (5 4 3), (4 4 4),
(6 2 2 2), (5 3 2 2), (4 3 3 2), (3 3 3 3),
(3 3 2 2 2),
(2 2 2 2 2 2).
MATHEMATICA
nn=22;
apsQ[y_]:=UnsameQ@@Times@@@Union[Rest@Subsets[y]];
Table[Length@Select[IntegerPartitions[n], apsQ], {n, nn}]
KEYWORD
nonn,more
AUTHOR
Gus Wiseman, Oct 23 2017
STATUS
approved
Number of factorizations of n into factors > 1 such that every distinct submultiset of the factors has a different average.
+10
2
1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 3, 1, 2, 2, 2, 1, 3, 1, 3, 2, 2, 1, 4, 1, 2, 2, 3, 1, 5, 1, 3, 2, 2, 2, 5, 1, 2, 2, 5, 1, 5, 1, 3, 3, 2, 1, 6, 1, 3, 2, 3, 1, 5, 2, 5, 2, 2, 1, 8, 1, 2, 3, 4, 2, 5, 1, 3, 2, 5, 1, 9, 1, 2, 3, 3, 2, 5, 1, 6, 2, 2, 1, 9, 2, 2, 2, 5, 1, 9, 2, 3, 2, 2, 2, 10, 1, 3, 3, 5, 1, 5, 1, 5, 4
OFFSET
1,6
COMMENTS
Note that such a factorization is necessarily strict.
LINKS
EXAMPLE
The a(80) = 6 factorizations are (80), (10*8), (16*5), (20*4), (40*2), (10*4*2).
MATHEMATICA
facs[n_]:=If[n<=1, {{}}, Join@@Table[Map[Prepend[#, d]&, Select[facs[n/d], Min@@#>=d&]], {d, Rest[Divisors[n]]}]];
Table[Length[Select[facs[n], UnsameQ@@Mean/@Union[Subsets[#]]&]], {n, 50}]
PROG
(PARI)
choosebybits(v, m) = { my(s=vector(hammingweight(m)), i=j=1); while(m>0, if(m%2, s[j] = v[i]; j++); i++; m >>= 1); s; };
hasdupavgs(v) = { my(avgs=Map(), k); for(i=1, (2^(#v))-1, k = (vecsum(choosebybits(v, i))/hammingweight(i)); if(mapisdefined(avgs, k), return(i), mapput(avgs, k, i))); (0); };
A316364(n, m=n, facs=List([])) = if(1==n, (0==hasdupavgs(Vec(facs))), my(s=0, newfacs); fordiv(n, d, if((d>1)&&(d<=m), newfacs = List(facs); listput(newfacs, d); s += A316364(n/d, d, newfacs))); (s)); \\ Antti Karttunen, Sep 21 2018
KEYWORD
nonn
AUTHOR
Gus Wiseman, Jun 30 2018
EXTENSIONS
More terms from Antti Karttunen, Sep 21 2018
STATUS
approved
Number of factorizations of n into factors > 1 such that every distinct subset of the factors has a different sum.
+10
2
1, 1, 1, 2, 1, 2, 1, 3, 2, 2, 1, 4, 1, 2, 2, 4, 1, 4, 1, 4, 2, 2, 1, 7, 2, 2, 3, 4, 1, 4, 1, 6, 2, 2, 2, 9, 1, 2, 2, 7, 1, 5, 1, 4, 4, 2, 1, 9, 2, 4, 2, 4, 1, 6, 2, 7, 2, 2, 1, 10, 1, 2, 4, 9, 2, 5, 1, 4, 2, 4, 1, 14, 1, 2, 4, 4, 2, 5, 1, 11, 5, 2, 1, 9, 2, 2, 2, 7, 1, 10, 2, 4, 2, 2, 2, 15, 1, 4, 4, 9, 1, 5, 1, 7, 5
OFFSET
1,4
COMMENTS
Also the number of factorizations of n into factors > 1 which form a knapsack partition.
EXAMPLE
The a(24) = 7 factorizations are (2*2*2*3), (2*2*6), (2*3*4), (2*12), (3*8), (4*6), (24).
The a(54) = 6 factorizations are (2*3*3*3), (2*3*9), (2*27), (3*18), (6*9), (54).
MATHEMATICA
facs[n_]:=If[n<=1, {{}}, Join@@Table[Map[Prepend[#, d]&, Select[facs[n/d], Min@@#>=d&]], {d, Rest[Divisors[n]]}]];
Table[Length[Select[facs[n], UnsameQ@@Total/@Union[Subsets[#]]&]], {n, 100}]
PROG
(PARI)
primeprodbybits(v, b) = { my(m=1, i=1); while(b>0, if(b%2, m *= prime(v[i])); i++; b >>= 1); (m); };
sumbybits(v, b) = { my(s=0, i=1); while(b>0, s += (b%2)*v[i]; i++; b >>= 1); (s); };
all_distinct_subsets_have_different_sums(v) = { my(m=Map(), s, pp); for(i=0, (2^#v)-1, pp = primeprodbybits(v, i); s = sumbybits(v, i); if(mapisdefined(m, s), if(mapget(m, s)!=pp, return(0)), mapput(m, s, pp))); (1); };
A316365(n, m=n, facs=List([])) = if(1==n, all_distinct_subsets_have_different_sums(Vec(facs)), my(s=0, newfacs); fordiv(n, d, if((d>1)&&(d<=m), newfacs = List(facs); listput(newfacs, d); s += A316365(n/d, d, newfacs))); (s)); \\ Antti Karttunen, Oct 08 2018
KEYWORD
nonn
AUTHOR
Gus Wiseman, Jun 30 2018
EXTENSIONS
More terms from Antti Karttunen, Oct 08 2018
STATUS
approved

Search completed in 0.005 seconds