The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A350472 Positive integers k such that if p is the next prime > k, and q is the previous prime < k, then p - k is prime and k - q is prime. 0
5, 9, 15, 21, 26, 34, 39, 45, 50, 56, 64, 69, 76, 81, 86, 92, 94, 99, 105, 111, 116, 120, 124, 129, 134, 142, 144, 146, 154, 160, 165, 170, 176, 184, 186, 188, 195, 204, 206, 216, 218, 225, 231, 236, 244, 246, 248, 254, 260, 266, 274, 279, 286, 288, 290, 296 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
a(n) can only be composite (excluding a(1) = 5).
LINKS
EXAMPLE
9 is a term because the next prime > 9 is 11 and the previous prime < 9 is 7, and 11 - 9 = 2 (which is prime) and 9 - 7 = 2 (which is also prime).
MAPLE
q:= n-> andmap(isprime, [nextprime(n)-n, n-prevprime(n)]):
select(q, [$3..400])[]; # Alois P. Heinz, Jan 01 2022
MATHEMATICA
Select[Range[350], And @@ PrimeQ[{# - NextPrime[#, -1], NextPrime[#] - #}] &] (* Amiram Eldar, Jan 01 2022 *)
PROG
(Python)
from sympy import isprime, nextprime, prevprime
def ok(n):
return n > 2 and isprime(nextprime(n) - n) and isprime(n - prevprime(n))
print([k for k in range(341) if ok(k)]) # Michael S. Branicky, Jan 01 2022
(PARI) isok(k) = my(p=nextprime(k+1), q=precprime(k-1)); isprime(p-k) && isprime(k-q); \\ Michel Marcus, Jan 01 2022
CROSSREFS
Intersection of A350496 and A350460.
Sequence in context: A215721 A315075 A315076 * A315077 A161536 A315078
KEYWORD
nonn
AUTHOR
Ryan Bresler, Jan 01 2022
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 6 00:30 EDT 2024. Contains 373110 sequences. (Running on oeis4.)