OFFSET
0,4
COMMENTS
This is a restricted version of A000607(n^2), allowing only prime parts p <= n.
EXAMPLE
a(1) = 0 since 1 has no partitions into prime parts.
a(2) = 1 since 4 = (2 + 2).
a(3) = 2 since 9 = (2 + 2 + 2 + 3) or (3 + 3 + 3).
a(4) = 3 since 16 = (2 + 2 + 2 + 2 + 2 + 2 + 2 + 2) or (2 + 2 + 2 + 2 + 2 + 3 + 3) or (2 + 2 + 3 + 3 + 3 + 3).
PROG
(Python)
from sympy import primerange
def a(n):
# Count partitions of n^2 into prime parts not exceeding n.
# b[k] stores the number of ways to make total k using the prime parts processed so far.
# Processing one prime at a time ensures that order is ignored, so 2+2+3 and 2+3+2 are not counted separately.
s=n*n; b=[1]+[0]*s
for p in primerange(n+1):
for k in range(p, s+1): b[k]+=b[k-p]
return b[s]
print([a(n) for n in range(32)])
CROSSREFS
KEYWORD
nonn
AUTHOR
Chuck Seggelin, May 11 2026
STATUS
approved
