OFFSET
1,1
COMMENTS
According to the prime glossary "a near-repunit prime is a prime all but one of whose digits are 1." This would also include {2, 3, 5, 7, 13, 17, 19, 31, 41, 61 and 71}, but this sequence only lists terms with more than two digits. - M. F. Hasler, Feb 10 2020
REFERENCES
C. Caldwell and H. Dubner, "The near repunit primes 1(n-k-1)01(1k)," J. Recreational Math., 27 (1995) 35-41.
Heleen, J. P., "More near-repunit primes 1(n-k-1)D(1)1(k), D=2,3, ..., 9," J. Recreational Math., 29:3 (1998) 190-195.
LINKS
T. D. Noe, Table of n, a(n) for n = 1..1000
Chris Caldwell, The Top 20 Near-repdigit Primes
Chris Caldwell, The Prime Glossary, Near-repunit prime
EXAMPLE
a(2)=113 is a term because 113 is a prime and all digits are 1 except one.
MATHEMATICA
lst = {}; Do[r = (10^n - 1)/9; Do[AppendTo[lst, DeleteCases[Select[FromDigits[Permutations[Append[IntegerDigits[r], d]]], PrimeQ], r]], {d, 0, 9}], {n, 2, 14}]; Sort[Flatten[lst]] (* Arkadiusz Wesolowski, Sep 20 2011 *)
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Shyam Sunder Gupta, Apr 29 2005
STATUS
approved