%I #16 Sep 09 2017 03:32:53
%S 0,0,5,26,124,852,7550,86125,1250924,23748764
%N a(n) = A275768(A002110(n)).
%C The number of ways to express primorial p_n# = A002110(n) as (prime(i) + prime(j))/2 when (prime(i) - prime(j))/2 also is prime.
%C Let p_n < q <= prime(pi(p_n#)), with pi(p_n#) = A000849(n). All such primes q are coprime to primorial p_n# since they are larger than the greatest prime factor of p_n#. One of the two primes counted by a(n) must be a prime q, the other a prime r = (2p_n# - q). Further, (r - q) must be prime to be counted by a(n). Therefore an efficient method of computing a(n) begins with generating the range of prime totatives prime(n + 1) <= q <= prime(pi(p_n#)) of primorial p_n#, the number of which is given by A048862(n).
%C a(n) < A048862(n) < A000849(n) for n > 2.
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/Primorial.html">Primorial</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/Totative.html">Totative</a>
%e a(3) = 5 since there are 5 ways to express A002110(3) = 30 as (prime(i) + prime(j))/2 with (prime(i) - prime(j))/2 also prime:
%e (53 + 7)/2 = 30, (53 - 7)/2 = 46/2 = 23
%e (47 + 13)/2 = 30, (47 - 13)/2 = 34/2 = 17
%e (43 + 17)/2 = 30, (43 - 17)/2 = 26/2 = 13
%e (41 + 19)/2 = 30, (41 - 19)/2 = 22/2 = 11
%e (37 + 23)/2 = 30, (37 - 23)/2 = 14/2 = 7.
%t With[{j = 10^3}, Do[Module[{P = Times @@ Prime@ Range@ n, m}, m = PrimePi@ P; Print@ Total@ Reap[Do[Sow@ Count[Map[{2 P - #, #} &, Prime@ Range[Max[n, k], Min[k + j - 1, m]]], w_ /; And[PrimeQ@ First@ w, PrimeQ[(Subtract @@ w)/2]]], {k, 1, m, j}]][[-1, 1]]], {n, 9}]] (* or *)
%t Table[Function[P, Count[Map[{2 P - #, #} &, #], w_ /; And[PrimeQ@ First@ w, PrimeQ[(Subtract @@ w)/2]]] &@ Flatten@ Select[Prime@ Range[n + 1, PrimePi[P]], Times @@ Boole@ Map[PrimeQ, {#, P - #}] == 1 &]]@ Product[Prime@ i, {i, n}], {n, 9}] (* _Michael De Vlieger_, May 03 2017 *)
%t countOfPrimes = 0
%t countOfPrimes2 = 0
%t countOfPrimes3 = 0
%t Pn10 = 2*3*5*7*11*13*17*19*23*29
%t PnToUse = Pn10
%t distanceToCheck = PnToUse
%t For[i=0,i<distanceToCheck,i++,
%t If[PrimeQ[2*PnToUse-i],
%t countOfPrimes++
%t If[PrimeQ[(2*PnToUse-i)-PnToUse],
%t countOfPrimes2++
%t If[PrimeQ[i],
%t countOfPrimes3++]],]]
%t Print[countOfPrimes3]
%t (*code example for Pn(10) outputs a(10)=23748764*)
%t (* _Jamie Morken_, May 05 2017 *)
%Y Cf. A000849, A002110, A048862, A275768.
%K nonn,hard,more
%O 1,3
%A _Michael De Vlieger_ and _Jamie Morken_, May 03 2017