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.

This page as a plain text file.
%I A381510 #21 Mar 10 2025 12:03:10
%S A381510 337,887,4297,33247,31907,124367,218287,1122287,1964987,1313467,
%T A381510 1468277,7160227,5518687,16525757,13626257,71880637,27915737,17051707,
%U A381510 394059907,566348087,252314747,472865287,1289694257,633418787,1588640437,944192807,1391048047,7059848287
%N 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.
%e A381510 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.
%o A381510 (PARI) a(n) = my(p=7); while (!isprime(p) || ((nextprime(p+1)-p) != 10*n), p+=10); p; \\ _Michel Marcus_, Feb 25 2025
%o A381510 (Python)
%o A381510 from sympy import nextprime, isprime
%o A381510 def A381510(n):
%o A381510     p = 17
%o A381510     while (q:=nextprime(p)):
%o A381510         if q-p == 10*n:
%o A381510             return p
%o A381510         p = q+9-(q+2)%10
%o A381510         while not isprime(p):
%o A381510             p += 10 # _Chai Wah Wu_, Mar 09 2025
%Y A381510 Cf. A101232, A140791, A380785, A381372.
%K A381510 nonn,base
%O A381510 1,1
%A A381510 _Jean-Marc Rebert_, Feb 25 2025