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.

A353073 Numbers that differ from their prime neighbors by a square.

This page as a plain text file.
%I A353073 #30 Jan 10 2023 20:17:10
%S A353073 4,6,12,18,30,42,60,72,93,102,108,138,140,148,150,180,182,190,192,198,
%T A353073 228,240,242,250,270,282,284,292,312,338,346,348,363,393,405,410,418,
%U A353073 420,422,430,432,453,462,483,495,522,532,548,556,570,578,586,600,618
%N A353073 Numbers that differ from their prime neighbors by a square.
%C A353073 Numbers sandwiched between twin primes form a subsequence.
%C A353073 The first prime in this sequence is 9551. - _Alois P. Heinz_, Apr 22 2022
%H A353073 Alois P. Heinz, <a href="/A353073/b353073.txt">Table of n, a(n) for n = 1..10000</a>
%e A353073 Prime neighbors of 93 are 89 and 97, they both differ from 93 by 4, a square. Thus, 93 is in this sequence.
%e A353073 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.
%p A353073 q:= n-> andmap(issqr, [n-prevprime(n), nextprime(n)-n]):
%p A353073 select(q, [$3..700])[];  # _Alois P. Heinz_, Apr 22 2022
%t A353073 Select[Range[3, 2000], IntegerQ[Sqrt[NextPrime[#] - #]] && IntegerQ[Sqrt[# - Prime[PrimePi[NextPrime[# - 1]] - 1]]] &]
%o A353073 (PARI) isok(k) = (k>1) && issquare(nextprime(k+1)-k) && issquare(k-precprime(k-1)); \\ _Michel Marcus_, Apr 22 2022
%o A353073 (Python)
%o A353073 from itertools import islice, count
%o A353073 from sympy import integer_nthroot, nextprime, prevprime
%o A353073 def A353073_gen(startvalue=3): # generator of terms >= startvalue
%o A353073     q = nextprime(max(startvalue,3)-1)
%o A353073     p, r = prevprime(q), nextprime(q)
%o A353073     while True:
%o A353073         if integer_nthroot(q-p,2)[1] and integer_nthroot(r-q,2)[1]:
%o A353073             yield q
%o A353073         t = q
%o A353073         for i in count(1):
%o A353073             t += 2*i-1
%o A353073             if t >= r:
%o A353073                 break
%o A353073             if integer_nthroot(r-t,2)[1]:
%o A353073                 yield t
%o A353073         p, q, r = q, r, nextprime(r)
%o A353073 A353073_list = list(islice(A353073_gen(),30)) # _Chai Wah Wu_, Apr 22 2022
%Y A353073 Cf. A353072.
%K A353073 nonn
%O A353073 1,1
%A A353073 _Tanya Khovanova_, Apr 21 2022