A132381 Number of partitions of n with exactly one prime number.
0, 1, 2, 3, 4, 7, 9, 12, 15, 22, 28, 38, 46, 62, 77, 98, 117, 152, 183, 230, 275, 344, 408, 504, 592, 726, 856, 1038, 1212, 1469, 1712, 2048, 2380, 2839, 3288, 3901, 4500, 5313, 6127, 7193, 8254, 9671, 11081, 12909, 14764, 17153, 19566, 22658, 25786, 29762
Offset: 1
Keywords
Examples
a(10) = #{8+2, 7+1+1+1, 6+3+1, 6+2+2, 6+2+1+1, 5+5, 5+4+1, 5+1+1+1+1+1, 4+4+2, 4+3+3, 4+3+1+1+1, 4+2+2+2, 4+2+2+1+1, 4+2+1+1+1+1, 3+3+3+1, 3+3+1+1+1+1, 3+1+1+1+1+1+1+1, 2+2+2+2+2, 2+2+2+2+1+1, 2+2+2+1+1+1+1, 2+2+1+1+1+1+1+1, 2+1+1+1+1+1+1+1+1} = 22.
Links
- Alois P. Heinz, Table of n, a(n) for n = 1..5000
Programs
-
Maple
b:= proc(n, i) option remember; local j; if n=0 then [1, 0] elif i<1 then [0$2] else b(n, i-1); for j to n/i do zip((x, y)->x+y, %, [`if`(isprime(i), 0, NULL), b(n-i*j, i-1)[]], 0) od; %[1..2] fi end: a:= n-> b(n$2)[2]: seq(a(n), n=1..60); # Alois P. Heinz, May 29 2013
-
Mathematica
zip = With[{m = Max[Length[#1], Length[#2]]}, PadRight[#1, m] + PadRight[#2, m]]&; b[n_, i_] := b[n, i] = Module[{j, pc}, Which[n == 0, {1, 0}, i<1, {0, 0}, True, pc = b[n, i-1]; For[j = 1, j <= n/i, j++, pc = zip[pc, Join[{If[PrimeQ[i], 0, Nothing]}, b[n-i*j, i-1]]] ]; pc[[1 ;; 2]] ]]; a[n_] := b[n, n][[2]]; Table[a[n], {n, 1, 60}] (* Jean-François Alcover, Feb 12 2017, after Alois P. Heinz *)