OFFSET
1,1
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..10000
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]
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Apr 22 2022
STATUS
approved