OFFSET
1,6
COMMENTS
a(n) = 0 for n = 1, 5, 7, 14, 16, 17, 18, 19, 33, 34, 43, 54, 77, 78, 80, 101, 127. Conjecture: these are all the n for which a(n) = 0.
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
a(6) = 3 because prime(6) + 2*prime(6+3) = 13 + 2*23 = 59 and prime(6) + 2*prime(6-3) = 13 + 2*5 = 23 are prime, while prime(6) + 2*prime(6-1) = 35 is not prime and prime(6) + 2*prime(6+2) = 51 is not prime.
MAPLE
N:= 100: # for a(1)..a(N)
Primes:= [seq(ithprime(i), i=1..2*N-1)]:
f:= proc(k) local p, n;
p:= Primes[k];
for n from 1 to k-1 do if isprime(p+2*Primes[k+n]) and isprime(p+2*Primes[k-n]) then return n fi
od;
0
end proc:
map(f, [$1..N]);
PROG
(PARI) a(n) = for (k=1, n-1, my(p=prime(n)); if (isprime(p + 2*prime(n-k)) && isprime(p + 2*prime(n+k)), return(k))); return(0); \\ Michel Marcus, May 06 2022
(Python)
from sympy import isprime, sieve
def a(n):
pn = sieve[n]
for k in range(1, n):
if isprime(pn + 2*sieve[n-k]) and isprime(pn + 2*sieve[n+k]):
return k
return 0
print([a(n) for n in range(1, 86)]) # Michael S. Branicky, May 10 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
J. M. Bergot and Robert Israel, May 05 2022
STATUS
approved