A381511 Smaller of two consecutive primes p and q, both ending with 9, such that q - p = 10*n, or -1 if no such primes exist.
139, 3089, 5749, 20809, 60539, 110359, 173359, 618719, 1294849, 838249, 6877109, 1895359, 11188759, 7621259, 35560009, 33803689, 124956059, 92801029, 142414669, 378043979, 229316459, 390932389, 1095750599, 995151679, 2174082649, 2603726969, 3402493709, 1997191249
Offset: 1
Examples
a(1) = 139, because 139 and 139 + 10 = 149 are two consecutive primes with the same last digit 9 and no smaller p has this property.
Programs
-
PARI
a(n) = my(p=9); while (!isprime(p) || ((nextprime(p+1)-p) != 10*n), p+=10); p; \\ Michel Marcus, Feb 25 2025
-
Python
from sympy import isprime, nextprime def A381511(n): p = 19 while (q:=nextprime(p)): if q-p == 10*n: return p p = q+9-(q%10) while not isprime(p): p += 10 # Chai Wah Wu, Mar 08 2025