Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #39 Oct 11 2021 13:25:34
%S 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,
%T 9,11,10,11,13,12,13,15,14,17,16,18,18,20,21,23,22,25,25,27,30,29,32,
%U 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
%N Number of partitions of n into two or more distinct primes.
%C Every positive integer can be written as a sum of two or more distinct primes except 1,2,3,4,6 and 11.
%F a(n) = A000586(n) - A010051(n).
%e a(5) = 1: 2+3.
%e a(18) = 4: 11+7, 11+5+2, 13+5, 13+3+2.
%p h:= proc(n) h(n):=`if`(n<2, 0, `if`(isprime(n), n, h(n-1))) end:
%p b:= proc(n, i) option remember; `if`(n=0, 1, `if`(i<2, 0,
%p b(n, h(i-1))+b(n-i, h(min(n-i, i-1)))))
%p end:
%p a:= n-> b(n, h(n-1)):
%p seq(a(n), n=1..100); # _Alois P. Heinz_, Sep 03 2021
%t 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 *)
%o (Python)
%o from sympy import isprime, primerange
%o from functools import cache
%o @cache
%o def A000586(n, k=None): # after _Charles R Greathouse IV_
%o if k == None: k = n
%o if n < 1: return int(n == 0)
%o return sum(A000586(n-p, p-1) for p in primerange(1, k+1))
%o def a(n): return A000586(n) - isprime(n)
%o print([a(n) for n in range(1, 83)]) # _Michael S. Branicky_, Sep 03 2021
%Y Cf. A000040, A000586, A010051, A166081.
%K nonn
%O 1,10
%A _Ayoub Saber Rguez_, Aug 31 2021