login

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”).

Number of partitions of n into 2 primes (counting 1 as a prime).
12

%I #21 Jan 03 2022 11:12:52

%S 1,1,2,1,2,1,2,1,2,0,2,1,3,1,2,0,3,1,3,1,3,0,4,1,3,0,2,0,4,1,3,1,4,0,

%T 4,0,3,1,3,0,5,1,4,1,4,0,6,1,4,0,3,0,6,1,3,0,4,0,7,1,4,1,5,0,6,0,3,1,

%U 5,0,7,1,6,1,5,0,7,0,5,1,5,0,9,1,5,0,4,0,10

%N Number of partitions of n into 2 primes (counting 1 as a prime).

%C Number of partitions of n into 2 noncomposite numbers, A008578. - _Antti Karttunen_, Dec 13 2021

%H Antti Karttunen, <a href="/A341945/b341945.txt">Table of n, a(n) for n = 2..20000</a>

%p b:= proc(n, i) option remember; series(`if`(n=0, 1,

%p `if`(i<0, 0, (p-> `if`(p>n, 0, x*b(n-p, i)))(

%p `if`(i=0, 1, ithprime(i)))+b(n, i-1))), x, 3)

%p end:

%p a:= n-> coeff(b(n, numtheory[pi](n)), x, 2):

%p seq(a(n), n=2..90); # _Alois P. Heinz_, Feb 24 2021

%t a[n_] := If[2 == n, 1, Module[{s = 0}, For[p = 2, True, p = NextPrime[p], If[p > n-p, Return[s + Boole[PrimeQ[n-1]]], s += Boole[PrimeQ[n-p]]]]]];

%t Table[a[n], {n, 2, 100}] (* _Jean-François Alcover_, Jan 03 2022, after _Antti Karttunen_ *)

%o (PARI) A341945(n) = if(2==n,1,my(s=0); forprime(p=2,,if(p>(n-p), return(s+isprime(n-1)), s += isprime(n-p)))); \\ _Antti Karttunen_, Dec 13 2021

%Y Cf. A001031, A008578, A034891, A061358, A341946, A341947, A341948, A341949, A341950, A341951.

%K nonn,look

%O 2,3

%A _Ilya Gutkovskiy_, Feb 24 2021