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.

A381510 Smaller of two consecutive primes p and q, both ending with 7, such that q - p = 10n, or -1 if no such primes exist.

Original entry on oeis.org

337, 887, 4297, 33247, 31907, 124367, 218287, 1122287, 1964987, 1313467, 1468277, 7160227, 5518687, 16525757, 13626257, 71880637, 27915737, 17051707, 394059907, 566348087, 252314747, 472865287, 1289694257, 633418787, 1588640437, 944192807, 1391048047, 7059848287
Offset: 1

Views

Author

Jean-Marc Rebert, Feb 25 2025

Keywords

Examples

			a(1) = 337, because 337 and 337 + 10 = 347 are two consecutive primes with the same last digit 7 and no smaller prime has this property.
		

Crossrefs

Programs

  • PARI
    a(n) = my(p=7); while (!isprime(p) || ((nextprime(p+1)-p) != 10*n), p+=10); p; \\ Michel Marcus, Feb 25 2025
    
  • Python
    from sympy import nextprime, isprime
    def A381510(n):
        p = 17
        while (q:=nextprime(p)):
            if q-p == 10*n:
                return p
            p = q+9-(q+2)%10
            while not isprime(p):
                p += 10 # Chai Wah Wu, Mar 09 2025