OFFSET
1,1
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..10000
EXAMPLE
Prime neighbors of 891 are 887 and 907, with different square differences 4 and 16. Thus, 891 is in this sequence.
MAPLE
q:= n-> (s-> nops(s)=2 and andmap(issqr, s))({n-prevprime(n), nextprime(n)-n}):
select(q, [$3..2000])[]; # Alois P. Heinz, Apr 22 2022
MATHEMATICA
Select[Range[3, 2000], IntegerQ[Sqrt[NextPrime[#] - #]] && IntegerQ[Sqrt[# - Prime[PrimePi[NextPrime[# - 1]] - 1]]] && NextPrime[#] - # != # - Prime[PrimePi[NextPrime[# - 1]] - 1] &]
PROG
(PARI) isok(k) = my(d, dd); (k>1) && issquare(nextprime(k+1)-k, &d) && issquare(k-precprime(k-1), &dd) && (d!=dd); \\ Michel Marcus, Apr 22 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Tanya Khovanova, Apr 21 2022
STATUS
approved