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!)
A353073 Numbers that differ from their prime neighbors by a square. 4
4, 6, 12, 18, 30, 42, 60, 72, 93, 102, 108, 138, 140, 148, 150, 180, 182, 190, 192, 198, 228, 240, 242, 250, 270, 282, 284, 292, 312, 338, 346, 348, 363, 393, 405, 410, 418, 420, 422, 430, 432, 453, 462, 483, 495, 522, 532, 548, 556, 570, 578, 586, 600, 618 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
Numbers sandwiched between twin primes form a subsequence.
The first prime in this sequence is 9551. - Alois P. Heinz, Apr 22 2022
LINKS
EXAMPLE
Prime neighbors of 93 are 89 and 97, they both differ from 93 by 4, a square. Thus, 93 is in this sequence.
Prime neighbors of 140 are 149 and 139. They differ from 140 by 9 and 1, respectively. Both differences are squares, thus, 140 is in this sequence.
MAPLE
q:= n-> andmap(issqr, [n-prevprime(n), nextprime(n)-n]):
select(q, [$3..700])[]; # Alois P. Heinz, Apr 22 2022
MATHEMATICA
Select[Range[3, 2000], IntegerQ[Sqrt[NextPrime[#] - #]] && IntegerQ[Sqrt[# - Prime[PrimePi[NextPrime[# - 1]] - 1]]] &]
PROG
(PARI) isok(k) = (k>1) && issquare(nextprime(k+1)-k) && issquare(k-precprime(k-1)); \\ Michel Marcus, Apr 22 2022
(Python)
from itertools import islice, count
from sympy import integer_nthroot, nextprime, prevprime
def A353073_gen(startvalue=3): # generator of terms >= startvalue
q = nextprime(max(startvalue, 3)-1)
p, r = prevprime(q), nextprime(q)
while True:
if integer_nthroot(q-p, 2)[1] and integer_nthroot(r-q, 2)[1]:
yield q
t = q
for i in count(1):
t += 2*i-1
if t >= r:
break
if integer_nthroot(r-t, 2)[1]:
yield t
p, q, r = q, r, nextprime(r)
A353073_list = list(islice(A353073_gen(), 30)) # Chai Wah Wu, Apr 22 2022
CROSSREFS
Cf. A353072.
Sequence in context: A074998 A061715 A280469 * A072570 A217259 A014574
KEYWORD
nonn
AUTHOR
Tanya Khovanova, Apr 21 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 May 7 20:13 EDT 2024. Contains 372317 sequences. (Running on oeis4.)