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.

Showing 1-2 of 2 results.

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

Original entry on oeis.org

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
Offset: 1

Views

Author

Tanya Khovanova, Apr 21 2022

Keywords

Comments

Numbers sandwiched between twin primes form a subsequence.
The first prime in this sequence is 9551. - Alois P. Heinz, Apr 22 2022

Examples

			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.
		

Crossrefs

Cf. A353072.

Programs

  • 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]]] &]
  • 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

A353074 Numbers that differ from their prime neighbors by distinct squares.

Original entry on oeis.org

140, 148, 182, 190, 242, 250, 284, 292, 338, 346, 410, 418, 422, 430, 548, 556, 578, 586, 632, 640, 692, 700, 710, 718, 788, 796, 812, 820, 830, 838, 891, 903, 920, 928, 1022, 1030, 1040, 1048, 1052, 1060, 1154, 1162, 1172, 1180, 1250, 1258, 1336, 1352, 1400
Offset: 1

Views

Author

Tanya Khovanova, Apr 21 2022

Keywords

Examples

			Prime neighbors of 891 are 887 and 907, with different square differences 4 and 16. Thus, 891 is in this sequence.
		

Crossrefs

Programs

  • 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] &]
  • 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
Showing 1-2 of 2 results.