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.

Original entry on oeis.org

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

Views

Author

G. L. Honaker, Jr., Aug 31 2009

Keywords

Crossrefs

Programs

  • 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 *)
  • 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

Extensions

Three more terms from Lekraj Beedassy, Dec 06 2009