A224344 Number T(n,k) of compositions of n using exactly k primes (counted with multiplicity); triangle T(n,k), n>=0, 0<=k<=floor(n/2), read by rows.
1, 1, 1, 1, 1, 3, 2, 5, 1, 3, 8, 5, 5, 13, 13, 1, 7, 23, 27, 7, 11, 39, 52, 25, 1, 17, 65, 99, 66, 9, 27, 106, 186, 151, 41, 1, 40, 177, 340, 323, 133, 11, 61, 293, 608, 666, 358, 61, 1, 92, 482, 1076, 1330, 867, 236, 13, 142, 781, 1894, 2581, 1971, 737, 85, 1
Offset: 0
Examples
A(5,1) = 8: [2,1,1,1], [1,2,1,1], [1,1,2,1], [1,1,1,2], [3,1,1], [1,3,1], [1,1,3], [5]. Triangle T(n,k) begins: 1; 1; 1, 1; 1, 3; 2, 5, 1; 3, 8, 5; 5, 13, 13, 1; 7, 23, 27, 7; 11, 39, 52, 25, 1; 17, 65, 99, 66, 9; 27, 106, 186, 151, 41, 1; 40, 177, 340, 323, 133, 11; ...
Links
- Alois P. Heinz, Rows n = 0..200, flattened
Crossrefs
Programs
-
Maple
T:= proc(n) option remember; local j; if n=0 then 1 else []; for j to n do zip((x, y)->x+y, %, [`if`(isprime(j), 0, NULL), T(n-j)], 0) od; %[] fi end: seq(T(n), n=0..16);
-
Mathematica
zip[f_, x_List, y_List, z_] := With[{m = Max[Length[x], Length[y]]}, Thread[f[PadRight[x, m, z], PadRight[y, m, z]]]]; T[n_] := T[n] = Module[{j, pc}, If[n == 0, {1}, pc = {}; For[j = 1, j <= n, j++, pc = zip[Plus, pc, Join[If[PrimeQ[j], {0}, {}], T[n-j]], 0]]; pc]]; Table[T[n], {n, 0, 16}] // Flatten (* Jean-François Alcover, Jan 29 2014, after Alois P. Heinz *)
Formula
Sum_{k=1..floor(n/2)} k * T(n,k) = A102291(n).