First time here? Check out the FAQ!
answered 2023-05-26 11:17:38 +0100
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)])