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.

A065585 Smallest prime beginning with exactly n 2's.

Original entry on oeis.org

3, 2, 223, 2221, 22229, 2222203, 22222253, 22222223, 222222227, 22222222273, 22222222223, 2222222222243, 22222222222201, 22222222222229, 222222222222227, 222222222222222043, 222222222222222281, 222222222222222221, 22222222222222222253, 222222222222222222277
Offset: 0

Views

Author

Robert G. Wilson v, Nov 28 2001

Keywords

Crossrefs

A068103 is a lower bound, but most often equality holds. - M. F. Hasler, Oct 17 2012

Programs

  • Mathematica
    Do[a = Table[2, {n}]; k = 0; While[b = FromDigits[ Join[a, IntegerDigits[k] ]]; First[ IntegerDigits[k]] == 2 || !PrimeQ[b], k++ ]; Print[b], {n, 1, 17} ]
  • PARI
    A065585(n)={n=10^n\9*2; n>2&for(d=1, 9e9, n*=10; for(t=1, 10^d-1, t\10^(d-1)==2 & t+= 10^(d-1)+(t>2); ispseudoprime(n+t) & return(n+t))); 2+!n} \\ M. F. Hasler, Oct 17 2012
    
  • Python
    from sympy import isprime
    def a(n):
      if n < 2: return list([3, 2])[n]
      n2s, i, pow10, end_digits = int('2'*n), 1, 1, 0
      while True:
        i = 1
        while i < pow10:
          istr = str(i)
          if istr[0] == '2' and len(istr) == end_digits:
            i += pow10 // 10
          else:
            t = n2s * pow10 + i
            if isprime(t): return t
            i += 2
        pow10 *= 10; end_digits += 1
    print([a(n) for n in range(20)]) # Michael S. Branicky, Mar 02 2021

Extensions

Corrected by Don Reble, Jan 17 2007