login
A353088
Primes having square prime gaps to both neighbor primes.
5
9551, 12889, 22193, 22307, 27143, 29917, 32261, 40423, 42863, 46807, 46993, 47981, 57637, 60041, 60493, 71597, 72613, 73819, 77137, 84263, 88427, 89153, 90583, 93463, 97463, 97613, 97883, 112543, 115057, 118931, 126307, 127877, 131321, 134093, 137873, 144883
OFFSET
1,1
LINKS
EXAMPLE
Prime 9551 is a term, the gap to the previous prime 9547 is 4 and the gap to the next prime 9587 is 36 and both gaps are squares.
MAPLE
q:= n-> isprime(n) and andmap(issqr, [n-prevprime(n), nextprime(n)-n]):
select(q, [$3..200000])[];
MATHEMATICA
q[n_] := PrimeQ[n] && IntegerQ@Sqrt[n-NextPrime[n, -1]] && IntegerQ@ Sqrt[NextPrime[n]-n];
Select[Range[3, 200000], q] (* Jean-François Alcover, May 14 2022, after Alois P. Heinz *)
Select[Prime[Range[2, 15000]], AllTrue[{Sqrt[#-NextPrime[#, -1]], Sqrt[NextPrime[#]-#]}, IntegerQ]&] (* Harvey P. Dale, Jan 22 2024 *)
PROG
(Python)
from itertools import islice
from sympy import nextprime, integer_nthroot
def A353088_gen(): # generator of terms
p, q, g, h = 3, 5, True, False
while True:
if g and h:
yield p
p, q = q, nextprime(q)
g, h = h, integer_nthroot(q-p, 2)[1]
A353088_list = list(islice(A353088_gen(), 30)) # Chai Wah Wu, Apr 22 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Apr 22 2022
STATUS
approved