%I #26 May 28 2021 20:45:37
%S 0,0,1,2,3,5,9,12,19,39,50,93,136,166,239,409,682,814,1314,1774,2081,
%T 3231,4272,6475,11077,14270,16265,20810,23621,30031,68251,85326,
%U 118917,132815,226097,251301,342448,463940,565844,759873,1015302,1117708,1787452,1961624
%N Number of integer partitions of prime(n) into a prime number of prime parts.
%H Alois P. Heinz, <a href="/A316154/b316154.txt">Table of n, a(n) for n = 1..1000</a> (first 200 terms from Andrew Howroyd)
%F a(n) = A085755(A000040(n)). - _Alois P. Heinz_, Jun 26 2018
%e The a(7) = 9 partitions of 17 into a prime number of prime parts: (13,2,2), (11,3,3), (7,7,3), (7,5,5), (7,3,3,2,2), (5,5,3,2,2), (5,3,3,3,3), (5,2,2,2,2,2,2), (3,3,3,2,2,2,2).
%p b:= proc(n, p, c) option remember; `if`(n=0 or p=2,
%p `if`(n::even and isprime(c+n/2), 1, 0),
%p `if`(p>n, 0, b(n-p, p, c+1))+b(n, prevprime(p), c))
%p end:
%p a:= n-> b(ithprime(n)$2, 0):
%p seq(a(n), n=1..50); # _Alois P. Heinz_, Jun 26 2018
%t Table[Length[Select[IntegerPartitions[Prime[n]],And[PrimeQ[Length[#]],And@@PrimeQ/@#]&]],{n,20}]
%t (* Second program: *)
%t b[n_, p_, c_] := b[n, p, c] = If[n == 0 || p == 2, If[EvenQ[n] && PrimeQ[c + n/2], 1, 0], If[p>n, 0, b[n - p, p, c + 1]] + b[n, NextPrime[p, -1], c]];
%t a[n_] := b[Prime[n], Prime[n], 0];
%t Array[a, 50] (* _Jean-François Alcover_, May 20 2021, after _Alois P. Heinz_ *)
%o (PARI) seq(n)={my(p=vector(n,k,prime(k))); my(v=Vec(1/prod(k=1, n, 1 - x^p[k]*y + O(x*x^p[n])))); vector(n, k, sum(i=1, k, polcoeff(v[1+p[k]], p[i])))} \\ _Andrew Howroyd_, Jun 26 2018
%Y Cf. A000040, A000586, A000607, A038499, A056768, A064688, A070215, A085755, A302590, A316092, A316153, A316185, A344782.
%K nonn
%O 1,4
%A _Gus Wiseman_, Jun 25 2018
%E Terms a(21) and beyond from _Andrew Howroyd_, Jun 26 2018
|