A316154 Number of integer partitions of prime(n) into a prime number of prime parts.
0, 0, 1, 2, 3, 5, 9, 12, 19, 39, 50, 93, 136, 166, 239, 409, 682, 814, 1314, 1774, 2081, 3231, 4272, 6475, 11077, 14270, 16265, 20810, 23621, 30031, 68251, 85326, 118917, 132815, 226097, 251301, 342448, 463940, 565844, 759873, 1015302, 1117708, 1787452, 1961624
Offset: 1
Keywords
Examples
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).
Links
- Alois P. Heinz, Table of n, a(n) for n = 1..1000 (first 200 terms from Andrew Howroyd)
Crossrefs
Programs
-
Maple
b:= proc(n, p, c) option remember; `if`(n=0 or p=2, `if`(n::even and isprime(c+n/2), 1, 0), `if`(p>n, 0, b(n-p, p, c+1))+b(n, prevprime(p), c)) end: a:= n-> b(ithprime(n)$2, 0): seq(a(n), n=1..50); # Alois P. Heinz, Jun 26 2018
-
Mathematica
Table[Length[Select[IntegerPartitions[Prime[n]],And[PrimeQ[Length[#]],And@@PrimeQ/@#]&]],{n,20}] (* Second program: *) 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]]; a[n_] := b[Prime[n], Prime[n], 0]; Array[a, 50] (* Jean-François Alcover, May 20 2021, after Alois P. Heinz *)
-
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
Formula
Extensions
Terms a(21) and beyond from Andrew Howroyd, Jun 26 2018