cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A164937 Near-repdigit primes.

This page as a plain text file.
%I A164937 #51 Apr 03 2023 10:36:11
%S A164937 101,113,131,151,181,191,199,211,223,227,229,233,277,311,313,331,337,
%T A164937 353,373,383,433,443,449,499,557,577,599,661,677,727,733,757,773,787,
%U A164937 797,811,877,881,883,887,911,919,929,977,991,997,1117,1151,1171,1181,1511
%N A164937 Near-repdigit primes.
%H A164937 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 A164937 Chris Caldwell, <a href="https://t5k.org/top20/page.php?id=15">The Top 20 Near-repdigit Primes</a>
%H A164937 Chris Caldwell, The Prime Glossary, <a href="https://t5k.org/glossary/xpage/nearrepdigitprime.html">Near-repdigit prime</a>
%H A164937 Brady Haran and Simon Pampena, <a href="https://www.youtube.com/watch?v=HPfAnX5blO0">Glitch Primes and Cyclops Numbers</a>, Numberphile video (2015)
%t A164937 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 A164937 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 A164937 (Python)
%o A164937 from sympy import isprime
%o A164937 from itertools import count, islice
%o A164937 def agen(): # generator of terms
%o A164937     for d in count(3):
%o A164937         ds = set()
%o A164937         for end in "1379":
%o A164937             ds.update(int(c*(d-1) + end) for c in "123456789" if c != end)
%o A164937             for diff in "0123456789":
%o A164937                 if end == diff: continue
%o A164937                 cands = (end*i + diff + end*(d-1-i) for i in range(d-1))
%o A164937                 ds.update(int(t) for t in cands if t[0] != "0")
%o A164937         yield from sorted(t for t in ds if isprime(t))
%o A164937 print(list(islice(agen(), 52))) # _Michael S. Branicky_, May 17 2022
%Y A164937 Cf. A105992, A105975, A105976, A105977, A105978, A105979, A105980, A105981, A105982, A065074.
%K A164937 nonn,base
%O A164937 1,1
%A A164937 _G. L. Honaker, Jr._, Aug 31 2009
%E A164937 Three more terms from _Lekraj Beedassy_, Dec 06 2009