Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Partitions into distinct primes OEIS:A000586

Hello, I am trying to return the number of partitions of $n$ into distinct primes, OEIS A000586. I tried copying the python example from the OEIS, changing "primerange" to "Primes" but got an error

def a(n,k=None):
    if k==None: k=n
    if n<1: return int(n==0)
    return sum(a(n-p,p-1) for p in Primes(1,k+1)
for n in srange(1,50):
    print(n,a(n))

I would really appreciate some help. Thank you!