login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A164937 Near-repdigit primes. 8

%I #51 Apr 03 2023 10:36:11

%S 101,113,131,151,181,191,199,211,223,227,229,233,277,311,313,331,337,

%T 353,373,383,433,443,449,499,557,577,599,661,677,727,733,757,773,787,

%U 797,811,877,881,883,887,911,919,929,977,991,997,1117,1151,1171,1181,1511

%N Near-repdigit primes.

%H Robert G. Wilson v, <a href="/A164937/b164937.txt">Table of n, a(n) for n = 1..22172</a> (first 5000 terms from Arkadiusz Wesolowski)

%H Chris Caldwell, <a href="https://t5k.org/top20/page.php?id=15">The Top 20 Near-repdigit Primes</a>

%H Chris Caldwell, The Prime Glossary, <a href="https://t5k.org/glossary/xpage/nearrepdigitprime.html">Near-repdigit prime</a>

%H Brady Haran and Simon Pampena, <a href="https://www.youtube.com/watch?v=HPfAnX5blO0">Glitch Primes and Cyclops Numbers</a>, Numberphile video (2015)

%t 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 *)

%t 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 *)

%o (Python)

%o from sympy import isprime

%o from itertools import count, islice

%o def agen(): # generator of terms

%o for d in count(3):

%o ds = set()

%o for end in "1379":

%o ds.update(int(c*(d-1) + end) for c in "123456789" if c != end)

%o for diff in "0123456789":

%o if end == diff: continue

%o cands = (end*i + diff + end*(d-1-i) for i in range(d-1))

%o ds.update(int(t) for t in cands if t[0] != "0")

%o yield from sorted(t for t in ds if isprime(t))

%o print(list(islice(agen(), 52))) # _Michael S. Branicky_, May 17 2022

%Y Cf. A105992, A105975, A105976, A105977, A105978, A105979, A105980, A105981, A105982, A065074.

%K nonn,base

%O 1,1

%A _G. L. Honaker, Jr._, Aug 31 2009

%E Three more terms from _Lekraj Beedassy_, Dec 06 2009

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified July 13 12:04 EDT 2024. Contains 374282 sequences. (Running on oeis4.)