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).
Comments