[go: up one dir, main page]

login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A164937
Near-repdigit primes.
8
101, 113, 131, 151, 181, 191, 199, 211, 223, 227, 229, 233, 277, 311, 313, 331, 337, 353, 373, 383, 433, 443, 449, 499, 557, 577, 599, 661, 677, 727, 733, 757, 773, 787, 797, 811, 877, 881, 883, 887, 911, 919, 929, 977, 991, 997, 1117, 1151, 1171, 1181, 1511
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 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
KEYWORD
nonn,base
AUTHOR
G. L. Honaker, Jr., Aug 31 2009
EXTENSIONS
Three more terms from Lekraj Beedassy, Dec 06 2009
STATUS
approved