login
Number of ways to write 2n as the sum of two nonprime positive integers.
1

%I #15 Jun 15 2020 23:42:46

%S 1,0,0,1,2,2,2,4,4,4,5,6,6,7,8,7,9,11,8,11,12,11,12,14,14,14,16,15,16,

%T 19,15,19,21,17,21,22,20,22,25,22,23,27,24,25,30,26,27,31,27,31,33,30,

%U 31,34,32,34,37,34,34,42,34,37,43,36,41,43,40,41,44,43

%N Number of ways to write 2n as the sum of two nonprime positive integers.

%H Robert Israel, <a href="/A334207/b334207.txt">Table of n, a(n) for n = 1..10000</a>

%H <a href="/index/Par#part">Index entries for sequences related to partitions</a>

%F a(n) = Sum_{i=1..n} (1 - c(i)) * (1 - c(2*n - i)), where c is the prime characteristic (A010051).

%e a(8) = 4; 2*8 = 16 has four partitions into nonprime parts, (15,1), (12,4), (10,6) and (8,8).

%p N:= 1000: # for a(1)..a(N)

%p NP:= remove(isprime, [$1..2*N]):

%p V:= Vector(N):

%p for i from 1 to nops(NP) do

%p for j from i do

%p x:= NP[i]+NP[j];

%p if x > 2*N then break fi;

%p if x::even then

%p V[x/2]:= V[x/2]+1;

%p fi

%p od od:

%p convert(V,list); # _Robert Israel_, Apr 20 2020

%t Table[Sum[(1 - PrimePi[i] + PrimePi[i - 1]) (1 - PrimePi[2 n - i] + PrimePi[2 n - i - 1]), {i, n}], {n, 100}]

%Y Cf. A010051.

%Y Bisection of A062610.

%K nonn,easy

%O 1,5

%A _Wesley Ivan Hurt_, Apr 18 2020