OFFSET
1,1
LINKS
Robert G. Wilson v, Table of n, a(n) for n = 1..22172 (first 5000 terms from Arkadiusz Wesolowski)
Chris Caldwell, The Top 20 Near-repdigit Primes
Chris Caldwell, The Prime Glossary, Near-repdigit prime
Brady Haran and Simon Pampena, Glitch Primes and Cyclops Numbers, Numberphile video (2015)
MATHEMATICA
lst = {}; Do[If[PrimeQ[n] && SortBy[Tally[IntegerDigits[n]], Last][[-1, -1]] == IntegerLength[n] - 1, AppendTo[lst, n]], {n, 101, 10^3}]; lst (* Arkadiusz Wesolowski, Sep 18 2011 *)
lst = {}; Do[r = (10^n - 1)/9; Do[AppendTo[lst, DeleteCases[Select[FromDigits[Permutations[Append[IntegerDigits[a*r], d]]], PrimeQ], r | 2 | 3 | 5 | 7]], {a, 9}, {d, 0, 9}], {n, 2, 6}]; Sort[Flatten[lst]] (* Arkadiusz Wesolowski, Sep 22 2011 *)
PROG
(Python)
from sympy import isprime
from itertools import count, islice
def agen(): # generator of terms
for d in count(3):
ds = set()
for end in "1379":
ds.update(int(c*(d-1) + end) for c in "123456789" if c != end)
for diff in "0123456789":
if end == diff: continue
cands = (end*i + diff + end*(d-1-i) for i in range(d-1))
ds.update(int(t) for t in cands if t[0] != "0")
yield from sorted(t for t in ds if isprime(t))
print(list(islice(agen(), 52))) # Michael S. Branicky, May 17 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
G. L. Honaker, Jr., Aug 31 2009
EXTENSIONS
Three more terms from Lekraj Beedassy, Dec 06 2009
STATUS
approved