login
A347419
Number of partitions of n into two or more distinct primes.
3
0, 0, 0, 0, 1, 0, 1, 1, 1, 2, 0, 2, 1, 2, 2, 3, 1, 4, 2, 4, 4, 4, 4, 5, 5, 6, 5, 6, 6, 6, 8, 7, 9, 9, 9, 11, 10, 11, 13, 12, 13, 15, 14, 17, 16, 18, 18, 20, 21, 23, 22, 25, 25, 27, 30, 29, 32, 32, 34, 37, 38, 40, 42, 44, 45, 50, 49, 53, 55, 57, 60, 64, 66, 70, 71, 76, 78, 83, 86, 89, 93, 96
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.
FORMULA
a(n) = A000586(n) - A010051(n).
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