OFFSET
3,1
COMMENTS
a(1) and a(2) are undefined. Alternatively, a(n) = least k, 1 < k < n, such that prime(n) + k and prime(n) - k are both prime. I conjecture that a(n) is defined for all n > 2. Equivalently, every prime > 3 is the average of two distinct primes.
a(n) embodies the difference between weak and strong Goldbach conjectures, and therefore between A047160 and A082467 which differ only for prime arguments (a(n)=A082467(prime(n)), while A047160(prime(n))=0). - Stanislav Sykora, Mar 14 2014
LINKS
Stanislav Sykora, Table of n, a(n) for n = 3..40000
FORMULA
EXAMPLE
prime(3) = 5 is the center of the interval [3,7] that has prime endpoints; this interval has radius = 7-5 = 2. Hence a(3) = 2. prime(5) = 11 is the center of the interval [5,17] that has prime endpoints; this interval has radius = 17-11 = 6. Hence a(5) = 6.
MATHEMATICA
f[n_] := Module[{p, k}, p = Prime[n]; k = 1; While[(k < p) && (! PrimeQ[p - k] || ! PrimeQ[p + k]), k = k + 1]; k]; Table[f[i], {i, 3, 103}]
PROG
(PARI) StrongGoldbachForPrimes(nmax)= {local(v, i, p, k); v=vector(nmax); for (i=1, nmax, p=prime(i); v[i] = -1; for (k=1, p-2, if (isprime(p-k)&&isprime(p+k), v[i]=k; break; ); ); ); return (v); } \\ Stanislav Sykora, Mar 14 2014
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Joseph L. Pe, Dec 09 2002
STATUS
approved