Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Like this

sage: @cached_function
....: def a(n,k=None):
....:     if k is None: k=n
....:     if n<1: return int(n==0)
....:     return sum(a(n-p,p-1) for p in prime_range(k+1))
....: print([a(n) for n in range(1,50)])