OFFSET
0,9
COMMENTS
Let N = 2*n = p + q where p and q are primes. We call such a pair (p, q) a Goldbach partition of N. A centered Goldbach partition is the Goldbach partition of the form (n - k, n + k) where k >= 0 is minimal. If N has a centered Goldbach partition then a(n) is this k and otherwise -1.
According to Goldbach's conjecture, any even N = 2n > 2 has a Goldbach partition, which is necessarily of the form p = n - k, q = n + k: namely, with n = (p+q)/2 and k = (q-p)/2. - M. F. Hasler, May 02 2019
LINKS
Peter Luschny, Table of n, a(n) for n = 0..10000
FORMULA
EXAMPLE
a(162571) = 78 because 325142 = 162493 + 162649 and there is no k, 0 <= k < 78, such that (162571 - k, 162571 + k) is a Goldbach partition of 325142.
MAPLE
a := proc(n) local k; for k from 0 to n do
if isprime(n + k) and isprime(n - k) then return k fi od: -1 end:
seq(a(n), n=0..83);
MATHEMATICA
a[n_] := Module[{k}, For[k = 0, k <= n, k++, If[PrimeQ[n+k] && PrimeQ[n-k], Return[k]]]; -1]; Table[a[n], {n, 0, 83}] (* Jean-François Alcover, Jul 06 2019, from Maple *)
PROG
(PARI) a(n) = for(k=0, n, if(ispseudoprime(n+k) && ispseudoprime(n-k), return(k))); -1 \\ Felix Fröhlich, May 02 2019
(PARI) apply( A325142(n)=-!forprime(p=n, 2*n, isprime(n*2-p)&&return(p-n)), [0..99]) \\ M. F. Hasler, May 02 2019
CROSSREFS
KEYWORD
sign
AUTHOR
Peter Luschny, May 02 2019
STATUS
approved