cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

This page as a plain text file.
%I A350472 #29 Jan 12 2022 21:42:03
%S A350472 5,9,15,21,26,34,39,45,50,56,64,69,76,81,86,92,94,99,105,111,116,120,
%T A350472 124,129,134,142,144,146,154,160,165,170,176,184,186,188,195,204,206,
%U A350472 216,218,225,231,236,244,246,248,254,260,266,274,279,286,288,290,296
%N 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.
%C A350472 a(n) can only be composite (excluding a(1) = 5).
%e A350472 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).
%p A350472 q:= n-> andmap(isprime, [nextprime(n)-n, n-prevprime(n)]):
%p A350472 select(q, [$3..400])[];  # _Alois P. Heinz_, Jan 01 2022
%t A350472 Select[Range[350], And @@ PrimeQ[{# - NextPrime[#, -1], NextPrime[#] - #}] &] (* _Amiram Eldar_, Jan 01 2022 *)
%o A350472 (Python)
%o A350472 from sympy import isprime, nextprime, prevprime
%o A350472 def ok(n):
%o A350472     return n > 2 and isprime(nextprime(n) - n) and isprime(n - prevprime(n))
%o A350472 print([k for k in range(341) if ok(k)]) # _Michael S. Branicky_, Jan 01 2022
%o A350472 (PARI) isok(k) = my(p=nextprime(k+1), q=precprime(k-1)); isprime(p-k) && isprime(k-q); \\ _Michel Marcus_, Jan 01 2022
%Y A350472 Intersection of A350496 and A350460.
%Y A350472 Cf. A175090, A225461.
%K A350472 nonn
%O A350472 1,1
%A A350472 _Ryan Bresler_, Jan 01 2022