login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Number of partitions of n containing at least one prime.
10

%I #15 Jan 28 2014 10:39:08

%S 0,0,1,2,3,5,8,12,17,24,34,48,65,88,118,157,205,269,348,450,575,734,

%T 929,1176,1473,1845,2297,2856,3527,4355,5346,6558,8004,9759,11848,

%U 14374,17363,20958,25210,30292,36278,43412,51792,61733,73383,87146,103239,122194

%N Number of partitions of n containing at least one prime.

%H Alois P. Heinz, <a href="/A235945/b235945.txt">Table of n, a(n) for n = 0..1000</a>

%F a(n) = A000041(n) - A002095(n).

%F Product_{k>0} 1/(1-x^k) - Product_{k>0} (1-x^prime(k))/(1-x^k). - _Alois P. Heinz_, Jan 18 2014

%e a(5) = 5 because 5 partitions of 5 contain at least one prime: [5], [3,2], [3,1,1], [2,2,1], [2,1,1,1].

%p b:= proc(n, i) option remember; `if`(n=0, 1, `if`(i<1, 0,

%p b(n, i-1)+`if`(i>n or isprime(i), 0, b(n-i, i))))

%p end:

%p a:= n-> combinat[numbpart](n) -b(n, n):

%p seq(a(n), n=0..50); # _Alois P. Heinz_, Jan 18 2014

%t b[n_, i_] := b[n, i] = If[n == 0, 1, If[i<1, 0, b[n, i-1] + If[i>n || PrimeQ[i], 0, b[n-i, i]]]]; a[n_] := PartitionsP[n]-b[n, n]; Table[a[n], {n, 0, 50}] (* _Jean-François Alcover_, Jan 28 2014, after _Alois P. Heinz_ *)

%Y Cf. A000041, A002095.

%K nonn

%O 0,4

%A _J. Stauduhar_, Jan 17 2014