OFFSET
1,10
COMMENTS
Every positive integer can be written as a sum of two or more distinct primes except 1,2,3,4,6 and 11.
EXAMPLE
a(5) = 1: 2+3.
a(18) = 4: 11+7, 11+5+2, 13+5, 13+3+2.
MAPLE
h:= proc(n) h(n):=`if`(n<2, 0, `if`(isprime(n), n, h(n-1))) end:
b:= proc(n, i) option remember; `if`(n=0, 1, `if`(i<2, 0,
b(n, h(i-1))+b(n-i, h(min(n-i, i-1)))))
end:
a:= n-> b(n, h(n-1)):
seq(a(n), n=1..100); # Alois P. Heinz, Sep 03 2021
MATHEMATICA
m = 24; Rest @ CoefficientList[Series[Product[(1 + x^Prime[k]), {k, 1, m}], {x, 0, Prime[m]}], x] - Table[Boole @ PrimeQ[n], {n, 1, Prime[m]}] (* Amiram Eldar, Sep 03 2021 *)
PROG
(Python)
from sympy import isprime, primerange
from functools import cache
@cache
def A000586(n, k=None): # after Charles R Greathouse IV
if k == None: k = n
if n < 1: return int(n == 0)
return sum(A000586(n-p, p-1) for p in primerange(1, k+1))
def a(n): return A000586(n) - isprime(n)
print([a(n) for n in range(1, 83)]) # Michael S. Branicky, Sep 03 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
Ayoub Saber Rguez, Aug 31 2021
STATUS
approved