login
A351692
a(n) is the least number k such that 1 <= k < n and prime(n) + 2*prime(n-k) and prime(n) + 2*prime(n+k) are both prime, or 0 if there is no such k.
2
0, 1, 1, 1, 0, 3, 0, 5, 5, 2, 6, 3, 5, 0, 4, 0, 0, 0, 0, 2, 19, 21, 2, 5, 18, 8, 24, 9, 12, 1, 1, 21, 0, 0, 23, 20, 34, 3, 28, 21, 12, 10, 0, 37, 33, 14, 4, 9, 35, 22, 14, 23, 1, 0, 18, 19, 21, 4, 39, 22, 16, 1, 8, 6, 42, 8, 16, 45, 31, 50, 40, 43, 18, 17, 32, 38, 0, 0, 26, 0, 44, 1, 62, 12, 4
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
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
Sequence in context: A004589 A354836 A197690 * A181840 A198432 A102391
KEYWORD
nonn
AUTHOR
J. M. Bergot and Robert Israel, May 05 2022
STATUS
approved