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.

A069677 Primes with either no internal digits or all internal digits are 2.

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 127, 223, 227, 229, 421, 521, 523, 727, 821, 823, 827, 829, 929, 1223, 1229, 2221, 3221, 3229, 4229, 5227, 6221, 6229, 7229, 8221, 9221, 9227, 12227, 22229, 42221
Offset: 1

Views

Author

Amarnath Murthy, Apr 06 2002

Keywords

Crossrefs

Programs

  • Mathematica
    Join[Prime[Range[25]],Select[Prime[Range[26,4500]],Union[Most[ Rest[ IntegerDigits[ #]]]] =={2}&]] (* Harvey P. Dale, Aug 12 2021 *)
  • PARI
    uptoqdigits(n) = { my(ld = [1,3,7,9]); n = max(n, 2); res = List(primes(primepi(97))); for(i = 1, n-2, twos = 20*(10^i\9); for(j = 1, 9, for(k = 1, #ld, c = j*10^(i+1) + twos + ld[k]; if(isprime(c), listput(res, c) ) ) ) ); Set(res) } \\ David A. Corneth, Aug 12 2021
    
  • Python
    from sympy import isprime
    def agen(maxdigits):
        yield from [2, 3, 5, 7]
        for d in range(2, maxdigits+1):
            pow10, mid = 10**(d-1), 0 if d < 3 else 10*int('2'*(d-2))
            cands = (a*pow10+mid+b for a in range(1, 10) for b in [1, 3, 7, 9])
            yield from filter(isprime, cands)
    print([an for an in agen(100)]) # Michael S. Branicky, Aug 12 2021

Extensions

Corrected by Ray Chandler, Nov 24 2003
Offset corrected and name changed by Arkadiusz Wesolowski, Sep 07 2011