A219180 Number T(n,k) of partitions of n into k distinct prime parts; triangle T(n,k), n>=0, read by rows.
1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 2, 1, 0, 1, 0, 0, 1, 0, 0, 2, 2, 0, 1, 1, 1, 0, 0, 2, 2, 0, 0, 1, 2, 1, 0, 0, 2, 2, 0, 1, 0, 2, 2, 0, 0, 3, 2, 0, 0, 1, 2, 2, 0, 0, 2, 3, 1
Offset: 0
Examples
T(0,0) = 1: [], the empty partition. T(2,1) = 1: [2]. T(5,1) = 1: [5], T(5,2) = 1: [2,3]. T(16,2) = 2: [5,11], [3,13]. Triangle T(n,k) begins: 1; ; 0, 1; 0, 1; ; 0, 1, 1; ; 0, 1, 1; 0, 0, 1; 0, 0, 1; 0, 0, 1, 1; 0, 1; 0, 0, 1, 1; ...
Links
- Alois P. Heinz, Rows n = 0..1000, flattened
Crossrefs
Programs
-
Maple
b:= proc(n, i) option remember; `if`(n=0, [1], `if`(i<1, [], zip((x, y)->x+y, b(n, i-1), [0, `if`(ithprime(i)>n, [], b(n-ithprime(i), i-1))[]], 0))) end: T:= proc(n) local l; l:= b(n, numtheory[pi](n)); while nops(l)>0 and l[-1]=0 do l:= subsop(-1=NULL, l) od; l[] end: seq(T(n), n=0..50);
-
Mathematica
nn=20;a=Table[Prime[n],{n,1,nn}];CoefficientList[Series[Product[1+y x^a[[i]],{i,1,nn}],{x,0,nn}],{x,y}]//Grid (* Geoffrey Critzer, Nov 21 2012 *) zip[f_, x_List, y_List, z_] := With[{m = Max[Length[x], Length[y]]}, f[PadRight[x, m, z], PadRight[y, m, z]]]; b[n_, i_] := b[n, i] = If[n == 0, {1}, If[i<1, {}, zip[Plus, b[n, i-1], Join[{0}, If[Prime[i] > n, {}, b[n-Prime[i], i-1]]], 0]]]; T[n_] := Module[{l}, l = b[n, PrimePi[n]]; While[Length[l]>0 && l[[-1]] == 0, l = ReplacePart[l, -1 -> Sequence[]]]; l]; Table[T[n], {n, 0, 50}] // Flatten (* Jean-François Alcover, Jan 29 2014, after Alois P. Heinz *)
-
PARI
T(n)={ Vec(prod(k=1, n, 1 + isprime(k)*y*x^k + O(x*x^n))) } { my(t=T(20)); for(n=1, #t, print(if(t[n]!=0, Vecrev(t[n]), []))) } \\ Andrew Howroyd, Dec 22 2017
Formula
G.f. of column k: Sum_{0
T(n,k) = [x^n*y^k] Product_{i>=1} (1+x^prime(i)*y).
A331844 Number of compositions (ordered partitions) of n into distinct squares.
1, 1, 0, 0, 1, 2, 0, 0, 0, 1, 2, 0, 0, 2, 6, 0, 1, 2, 0, 0, 2, 6, 0, 0, 0, 3, 8, 0, 0, 8, 30, 0, 0, 0, 2, 6, 1, 2, 6, 24, 2, 8, 6, 0, 0, 8, 30, 0, 0, 7, 32, 24, 2, 8, 30, 120, 6, 24, 2, 6, 0, 8, 36, 24, 1, 34, 150, 0, 2, 12, 30, 24, 0, 2, 38, 150, 0, 12, 78, 144, 2
Offset: 0
Keywords
Examples
a(14) = 6 because we have [9,4,1], [9,1,4], [4,9,1], [4,1,9], [1,9,4] and [1,4,9].
Links
Crossrefs
Programs
-
Maple
b:= proc(n, i, p) option remember; `if`(i*(i+1)*(2*i+1)/6
n, 0, b(n-i^2, i-1, p+1))+b(n, i-1, p))) end: a:= n-> b(n, isqrt(n), 0): seq(a(n), n=0..82); # Alois P. Heinz, Jan 30 2020 -
Mathematica
b[n_, i_, p_] := b[n, i, p] = If[i(i+1)(2i+1)/6 < n, 0, If[n == 0, p!, If[i^2 > n, 0, b[n - i^2, i - 1, p + 1]] + b[n, i - 1, p]]]; a[n_] := b[n, Sqrt[n] // Floor, 0]; a /@ Range[0, 82] (* Jean-François Alcover, Oct 29 2020, after Alois P. Heinz *)
A331843 Number of compositions (ordered partitions) of n into distinct triangular numbers.
1, 1, 0, 1, 2, 0, 1, 2, 0, 2, 7, 2, 0, 2, 6, 1, 4, 6, 2, 12, 24, 3, 8, 0, 8, 32, 6, 2, 13, 26, 6, 34, 36, 0, 32, 150, 3, 20, 50, 14, 54, 126, 32, 32, 12, 55, 160, 78, 122, 44, 174, 4, 72, 294, 36, 201, 896, 128, 62, 180, 176, 164, 198, 852, 110, 320, 159, 212, 414
Offset: 0
Keywords
Examples
a(10) = 7 because we have [10], [6, 3, 1], [6, 1, 3], [3, 6, 1], [3, 1, 6], [1, 6, 3] and [1, 3, 6].
Links
Crossrefs
Programs
-
Maple
h:= proc(n) option remember; `if`(n<1, 0, `if`(issqr(8*n+1), 1+h(n-1), h(n-1))) end: b:= proc(n, i, p) option remember; (t-> `if`(t*(i+2)/3
n, 0, b(n-t, i-1, p+1)))))((i*(i+1)/2)) end: a:= n-> b(n, h(n), 0): seq(a(n), n=0..73); # Alois P. Heinz, Jan 31 2020 -
Mathematica
h[n_] := h[n] = If[n<1, 0, If[IntegerQ @ Sqrt[8n+1], 1 + h[n-1], h[n-1]]]; b[n_, i_, p_] := b[n, i, p] = Function[t, If[t (i + 2)/3 < n, 0, If[n == 0, p!, b[n, i-1, p] + If[t>n, 0, b[n - t, i - 1, p + 1]]]]][(i(i + 1)/2)]; a[n_] := b[n, h[n], 0]; a /@ Range[0, 73] (* Jean-François Alcover, Apr 27 2020, after Alois P. Heinz *)
A331845 Number of compositions (ordered partitions) of n into distinct cubes.
1, 1, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 2, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 2, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 6, 0, 0, 0, 0, 0, 0, 6, 24
Offset: 0
Examples
a(36) = 6 because we have [27,8,1], [27,1,8], [8,27,1], [8,1,27], [1,27,8] and [1,8,27].
Links
Crossrefs
Programs
-
Maple
b:= proc(n, i, p) option remember; `if`((i*(i+1)/2)^2
n, 0, b(n-i^3, i-1, p+1))+b(n, i-1, p))) end: a:= n-> b(n, iroot(n, 3), 0): seq(a(n), n=0..100); # Alois P. Heinz, Jan 30 2020 -
Mathematica
b[n_, i_, p_] := b[n, i, p] = If[(i(i+1)/2)^2 < n, 0, If[n == 0, p!, If[i^3 > n, 0, b[n-i^3, i-1, p+1]] + b[n, i-1, p]]]; a[n_] := b[n, Floor[n^(1/3)], 0]; a /@ Range[0, 100] (* Jean-François Alcover, Oct 31 2020, after Alois P. Heinz *)
A331846 Number of compositions (ordered partitions) of n into distinct squarefree parts.
1, 1, 1, 3, 2, 3, 9, 5, 12, 16, 21, 41, 42, 49, 59, 79, 130, 231, 230, 295, 226, 495, 609, 699, 1472, 1042, 1377, 2308, 2982, 3425, 3879, 4877, 7156, 7189, 13531, 14797, 13570, 19551, 27667, 30327, 36382, 47519, 60783, 70561, 78330, 136988, 121659, 174851
Offset: 0
Keywords
Examples
a(7) = 5 because we have [7], [6, 1], [5, 2], [2, 5] and [1, 6].
A331847 Number of compositions (ordered partitions) of n into distinct prime powers (1 excluded).
1, 0, 1, 1, 1, 3, 2, 5, 3, 11, 10, 13, 18, 19, 52, 30, 61, 77, 114, 109, 146, 260, 318, 341, 356, 631, 666, 927, 848, 1849, 1978, 2305, 2213, 3560, 4302, 4748, 5588, 6779, 13952, 9044, 15534, 16897, 25084, 20731, 29524, 34882, 49360, 50765, 55112, 106903, 83652, 128552, 106638
Offset: 0
Keywords
Examples
a(10) = 10 because we have [8, 2], [7, 3], [5, 3, 2], [5, 2, 3], [3, 7], [3, 5, 2], [3, 2, 5], [2, 8], [2, 5, 3] and [2, 3, 5].
A301428 Number of compositions (ordered partitions) of n into prime parts such that no two adjacent parts are equal (Carlitz compositions).
1, 0, 1, 1, 0, 3, 0, 4, 3, 3, 10, 3, 16, 12, 18, 35, 24, 64, 57, 90, 137, 136, 259, 270, 416, 573, 679, 1088, 1264, 1869, 2491, 3199, 4691, 5834, 8341, 11053, 14685, 20595, 26636, 37199, 49449, 66572, 91377, 120733, 166151, 221912, 300038, 407775, 544843, 743318, 996752
Offset: 0
Keywords
Examples
a(7) = 4 because we have [7], [5, 2], [2, 5] and [2, 3, 2].
Links
Programs
-
Mathematica
nmax = 50; CoefficientList[Series[1/(1 - Sum[x^Prime[k]/(1 + x^Prime[k]), {k, 1, nmax}]), {x, 0, nmax}], x]
Formula
G.f.: 1/(1 - Sum_{k>=1} x^prime(k)/(1 + x^prime(k))).
A331981 Number of compositions (ordered partitions) of n into distinct odd primes.
1, 0, 0, 1, 0, 1, 0, 1, 2, 0, 2, 1, 2, 1, 2, 6, 4, 1, 4, 7, 4, 12, 4, 13, 6, 12, 28, 18, 28, 19, 6, 25, 52, 24, 54, 30, 56, 31, 98, 156, 102, 37, 104, 157, 150, 276, 150, 175, 154, 288, 200, 528, 246, 307, 226, 666, 990, 780, 1038, 679, 348, 799, 1828, 1272, 1162, 1164
Offset: 0
Keywords
Examples
a(16) = 4 because we have [13, 3], [11, 5], [5, 11] and [3, 13].
Links
Programs
-
Maple
s:= proc(n) option remember; `if`(n<1, 0, ithprime(n+1)+s(n-1)) end: b:= proc(n, i, t) option remember; `if`(s(i)
`if`(p>n, 0, b(n-p, i-1, t+1)))(ithprime(i+1))+b(n, i-1, t))) end: a:= n-> b(n, numtheory[pi](n), 0): seq(a(n), n=0..72); # Alois P. Heinz, Feb 03 2020 -
Mathematica
s[n_] := s[n] = If[n < 1, 0, Prime[n + 1] + s[n - 1]]; b[n_, i_, t_] := b[n, i, t] = If[s[i] < n, 0, If[n == 0, t!, If[# > n, 0, b[n - #, i - 1, t + 1]]&[Prime[i + 1]] + b[n, i - 1, t]]]; a[n_] := b[n, PrimePi[n], 0]; a /@ Range[0, 72] (* Jean-François Alcover, Nov 09 2020, after Alois P. Heinz *)
A331926 Number of compositions (ordered partitions) of n into distinct prime parts (counting 1 as a prime).
1, 1, 1, 3, 2, 3, 8, 3, 10, 8, 14, 31, 10, 33, 16, 38, 40, 61, 138, 69, 48, 98, 190, 121, 308, 128, 340, 270, 472, 991, 572, 885, 534, 446, 888, 1872, 914, 1927, 1084, 2300, 2058, 4303, 6508, 3759, 2246, 4856, 8238, 6889, 12630, 6368, 8708
Offset: 0
Keywords
Examples
a(6) = 8 because we have [5, 1], [3, 2, 1], [3, 1, 2], [2, 3, 1], [2, 1, 3], [1, 5], [1, 3, 2] and [1, 2, 3].
Programs
-
PARI
a(n)={subst(serlaplace(y^0*polcoef(prod(k=1, n, 1 + if(k==1 || isprime(k), y*x^k) + O(x*x^n)), n)), y, 1)} \\ Andrew Howroyd, Feb 01 2020
A339432 Number of compositions (ordered partitions) of n into an even number of distinct primes.
1, 0, 0, 0, 0, 2, 0, 2, 2, 2, 2, 0, 2, 2, 2, 2, 4, 24, 4, 2, 4, 26, 4, 48, 6, 50, 28, 48, 28, 72, 6, 74, 52, 98, 54, 96, 56, 120, 98, 122, 102, 864, 104, 146, 150, 866, 150, 1584, 154, 938, 200, 1632, 246, 3072, 226, 1706, 990, 3864, 1038, 4560, 348, 3914, 1828, 4634, 1162, 7488
Offset: 0
Keywords
Examples
a(16) = 4 because we have [13, 3], [3, 13], [11, 5] and [5, 11].
Links
Programs
-
Maple
b:= proc(n, i, p) option remember; `if`(n=0, irem(1+p, 2)*p!, (s-> `if`(s>n, 0, b(n, i+1, p)+b(n-s, i+1, p+1)))(ithprime(i))) end: a:= n-> b(n, 1, 0): seq(a(n), n=0..70); # Alois P. Heinz, Dec 04 2020
-
Mathematica
b[n_, i_, p_] := b[n, i, p] = If[n == 0, Mod[1 + p, 2]*p!, Function[s, If[s > n, 0, b[n, i + 1, p] + b[n - s, i + 1, p + 1]]][Prime[i]]]; a[n_] := b[n, 1, 0]; Table[a[n], {n, 0, 70}] (* Jean-François Alcover, Feb 26 2022, after Alois P. Heinz *)
Comments