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-3 of 3 results.

A353088 Primes having square prime gaps to both neighbor primes.

Original entry on oeis.org

9551, 12889, 22193, 22307, 27143, 29917, 32261, 40423, 42863, 46807, 46993, 47981, 57637, 60041, 60493, 71597, 72613, 73819, 77137, 84263, 88427, 89153, 90583, 93463, 97463, 97613, 97883, 112543, 115057, 118931, 126307, 127877, 131321, 134093, 137873, 144883
Offset: 1

Views

Author

Alois P. Heinz, Apr 22 2022

Keywords

Examples

			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.
		

Crossrefs

Programs

  • 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 *)
  • 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]
    A353088_list = list(islice(A353088_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

A353089 Least number which differs from both of its prime neighbors by n^2, and -1 if no such number exists.

Original entry on oeis.org

4, 93, 532, 5607, 31932, 31433, 604122, 3851523, 39175298, 378044079, 367876650, 383204683, 22076314482
Offset: 1

Views

Author

Jean-Marc Rebert, Apr 22 2022

Keywords

Comments

a(12) < 1294268635 is the first term where the first formula is a strict inequality. - Michael S. Branicky, Apr 22 2022

Examples

			a(1) = 4, because 3 and 5 are the prime neighbors of 4, and 5 - 4 = 4 - 3 = 1 = 1^2 and no number less than 4 differs from both of its prime neighbors by 1^2.
a(2) = 93, because 97 and 89 are the prime neighbors of 93, and 97 - 93 = 93 - 89 = 4 = 2^2 and no number less than 93 differs from both of its prime neighbors by 2^2.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := a[n] = Module[{diff, diff2, p, q, r},
         {diff, diff2, p} = {n*n, 2*n*n, NextPrime[1 + n^2]};
         q = NextPrime[p];
         r = NextPrime[q];
         While[!(q - p == diff2 || (q - p == diff && r - q == diff)),
              {p, q, r} = {q, r, NextPrime[r]}];
         Return[If[q - p == diff2, Floor[(q + p)/2], q]]];
    Table[Print[n, " ", a[n]]; a[n], {n, 1, 10}] (* Jean-François Alcover, Jun 07 2022, after Michael S. Branicky's code *)
  • PARI
    a(n) = my(k=2); while (((nextprime(k+1)-k) != n^2) || ((k-precprime(k-1)) != n^2), k++); k; \\ Michel Marcus, Jul 10 2022
  • Python
    from sympy import nextprime
    def a(n):
        diff, diff2, p = n*n, 2*n*n, nextprime(1+n**2)
        q = nextprime(p)
        r = nextprime(q)
        while not (q-p == diff2 or (q-p == diff and r-q == diff)):
            p, q, r = q, r, nextprime(r)
        return (q+p)//2 if q-p == diff2 else q
    print([a(n) for n in range(1, 9)]) # Michael S. Branicky, Apr 22 2022
    

Formula

a(n) <= A000040(A038664(n^2)) + n^2. - Alois P. Heinz, Apr 22 2022
a(n) <= A000230(n^2) + n^2. - David A. Corneth, May 02 2022
a(n) = A282690(n^2). - Michel Marcus, Jul 10 2022

Extensions

a(13) from Michael S. Branicky, Apr 24 2022
Showing 1-3 of 3 results.