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.

Showing 1-10 of 16 results. Next

A037055 Smallest prime containing exactly n 1's.

Original entry on oeis.org

2, 13, 11, 1117, 10111, 101111, 1111151, 11110111, 101111111, 1111111121, 11111111113, 101111111111, 1111111118111, 11111111111411, 111111111116111, 1111111111111181, 11111111101111111, 101111111111111111, 1111111111111111171, 1111111111111111111, 111111111111111119111
Offset: 0

Views

Author

Patrick De Geest, Jan 04 1999

Keywords

Comments

For n > 1, A037055 is conjectured to be identical to A084673. - Robert G. Wilson v, Jul 04 2003
a(n) = A002275(n) for n in A004023. For all other n < 900, a(n) has n+1 digits. - Robert Israel, Feb 21 2016

Crossrefs

Programs

  • Maple
    f:= proc(n) local m,d,r,x;
       r:= (10^n-1)/9;
       if isprime(r) then return r fi;
       r:= (10^(n+1)-1)/9;
       for m from n-1 to 1 by -1 do
         x:= r - 10^m;
         if isprime(x) then return x fi;
       od;
       for m from 0 to n do
         for d from 1 to 8 do
            x:= r + d*10^m;
            if isprime(x) then return x fi;
         od
       od;
       error("Needs more than n+1 digits")
    end proc:
    map(f, [$0..100]); # Robert Israel, Feb 21 2016
  • Mathematica
    f[n_, b_] := Block[{k = 10^(n + 1), p = Permutations[ Join[ Table[b, {i, 1, n}], {x}]], c = Complement[Table[j, {j, 0, 9}], {b}], q = {}}, Do[q = Append[q, Replace[p, x -> c[[i]], 2]], {i, 1, 9}]; r = Min[ Select[ FromDigits /@ Flatten[q, 1], PrimeQ[ # ] & ]]; If[r ? Infinity, r, p = Permutations[ Join[ Table[ b, {i, 1, n}], {x, y}]]; q = {}; Do[q = Append[q, Replace[p, {x -> c[[i]], y -> c[[j]]}, 2]], {i, 1, 9}, {j, 1, 9}]; Min[ Select[ FromDigits /@ Flatten[q, 1], PrimeQ[ # ] & ]]]]; Table[ f[n, 1], {n, 1, 18}]
    Join[{2, 13}, Table[Sort[Flatten[Table[Select[FromDigits/@Permutations[Join[{n}, PadRight[{}, i, 1]]], PrimeQ], {n, 0, 9}]]][[1]], {i, 2, 20}]] (* Vincenzo Librandi, May 11 2017 *)
  • PARI
    A037055(n)={my(p,t=10^(n+1)\9); forstep(k=n+1,1,-1, ispseudoprime(p=t-10^k) && return(p)); forvec(v=[[0, n], [1, 8]], ispseudoprime(p=t+10^v[1]*v[2]) && return(p))} \\ M. F. Hasler, Feb 22 2016

Formula

a(n) = the smallest prime in { R-10^n, R-10^(n-1), ..., R-10; R+a*10^b, a=1, ..., 8, b=0, 1, 2, ..., n }, where R = (10^(n+1)-1)/9 is the (n+1)-digit repunit. - M. F. Hasler, Feb 25 2016
a(n) = prime(A037054(n)). - Amiram Eldar, Jul 21 2025

Extensions

More terms from Sascha Kurz, Feb 10 2003
Edited by Robert G. Wilson v, Jul 04 2003
a(0) = 2 inserted by Robert Israel, Feb 21 2016

A068104 Smallest prime starting with n 3s.

Original entry on oeis.org

2, 3, 331, 3331, 33331, 333331, 3333331, 33333331, 3333333319, 33333333329, 333333333323, 3333333333301, 33333333333319, 333333333333307, 3333333333333301, 33333333333333323, 333333333333333331
Offset: 0

Views

Author

Amarnath Murthy, Feb 20 2002

Keywords

Crossrefs

Programs

  • Mathematica
    Join[{2,3},Table[SelectFirst[Join[10FromDigits[PadRight[{},k,3]]+{1,7,9},Flatten[Table[100 FromDigits[PadRight[{},k,3]]+10n+{1,3,7,9},{n,0,9}]],Flatten[Table[1000 FromDigits[PadRight[{},k,3]]+100n+{1,3,7,9},{n,0,99}]]],PrimeQ],{k,2,20}]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Jun 01 2019 *)

Extensions

More terms from Sascha Kurz, Mar 19 2002

A065592 Smallest prime beginning with exactly n 9's.

Original entry on oeis.org

2, 97, 991, 99901, 99991, 9999901, 9999991, 999999929, 9999999929, 99999999907, 999999999937, 9999999999971, 99999999999923, 999999999999947, 9999999999999917, 99999999999999919, 99999999999999997, 9999999999999999919, 99999999999999999931
Offset: 0

Views

Author

Robert G. Wilson v, Nov 28 2001

Keywords

Crossrefs

Programs

  • Mathematica
    fp[n_]:=Select[Join[10*n+{1,7},100*n+Range[1,99,2]],PrimeQ,1]; With[{ns=Table[FromDigits[PadRight[{},n,9]],{n,20}]}, Join[{2}, Flatten[fp/@ns]]] (* Harvey P. Dale, May 12 2012 *)

Extensions

Corrected by Don Reble, Jan 17 2007
Offset corrected by Sean A. Irvine, Sep 06 2023

A065821 a(n) is the smallest prime ending in exactly n 1's.

Original entry on oeis.org

31, 11, 2111, 101111, 311111, 29111111, 61111111, 1711111111, 14111111111, 31111111111, 311111111111, 2111111111111, 31111111111111, 3511111111111111, 5111111111111111, 101111111111111111, 3511111111111111111, 2111111111111111111, 1111111111111111111, 911111111111111111111
Offset: 1

Views

Author

Jonathan Ayres (jonathan.ayres(AT)btinternet.com), Nov 23 2001

Keywords

Examples

			a(4) = 101111 because 1111=11*101, 21111=3*31*227, 31111=53*587, 41111=7^2*829, 51111=3^4*631, 61111=23*2657, 71111=17*47*89, 81111=3*19*1423, 91111=179*509 so 101111 is the first prime ending in four 1's.
		

Crossrefs

Programs

  • Mathematica
    pe[n_]:=Module[{k=0,len=IntegerLength[n]},While[Mod[k,10]==1||(!PrimeQ[ k*10^len+n]),k++];k*10^len+n]; pe/@Table[(10^n-1)/9,{n,20}] (* Harvey P. Dale, Dec 31 2013 *)_
  • PARI
    a(n)={ my(f=10^n, b=(f-1)/9, k=0); while (!isprime(b + k*f), k+=1+(k%10==0)); b + k*f } \\ Harry J. Smith, Nov 01 2009

Extensions

Edited and extended by Robert G. Wilson v, Jul 04 2003

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

A065586 Smallest prime beginning with exactly n 3's.

Original entry on oeis.org

2, 3, 331, 3331, 33331, 333331, 3333331, 33333331, 3333333319, 33333333329, 333333333323, 3333333333301, 33333333333319, 333333333333307, 3333333333333301, 33333333333333323, 333333333333333391, 333333333333333331, 33333333333333333359, 3333333333333333333041
Offset: 0

Views

Author

Robert G. Wilson v, Nov 28 2001

Keywords

Crossrefs

Extensions

Corrected by Don Reble, Jan 17 2007
Offset corrected by Sean A. Irvine, Sep 06 2023

A068103 Smallest prime starting with at least n 2s.

Original entry on oeis.org

2, 2, 223, 2221, 22229, 2222203, 22222223, 22222223, 222222227, 22222222223, 22222222223, 2222222222243, 22222222222201, 22222222222229, 222222222222227, 222222222222222043, 222222222222222221
Offset: 0

Views

Author

Amarnath Murthy, Feb 20 2002

Keywords

Crossrefs

Programs

  • PARI
    A068103(n)={n=10^n\9*2;n>2&for(d=1,9e9,n*=10;for(t=1,10^d-1,ispseudoprime(n+t)&return(n+t)));2} \\ - M. F. Hasler, Oct 17 2012

Extensions

More terms from Sascha Kurz, Mar 19 2002
Corrected by Don Reble, Jan 17 2007

A068105 Smallest prime starting with n 5s.

Original entry on oeis.org

2, 5, 557, 5557, 555521, 555557, 55555517, 55555553, 5555555501, 5555555557, 555555555551, 555555555551, 5555555555551, 555555555555529, 555555555555557, 55555555555555519, 555555555555555559, 555555555555555559, 55555555555555555567, 5555555555555555555087
Offset: 0

Views

Author

Amarnath Murthy, Feb 20 2002

Keywords

Crossrefs

Programs

  • Python
    from sympy import isprime
    def a(n):
      if n < 2: return list([2, 5])[n]
      n5s, i, pow10 = int('5'*n), 1, 1
      while True:
        i = 1
        while i < pow10:
          t = n5s * pow10 + i
          if isprime(t): return t
          i += 2
        pow10 *= 10
    print([a(n) for n in range(20)]) # Michael S. Branicky, Feb 05 2021

Formula

a(n) <= A065588(n). - Michael S. Branicky, Feb 05 2021

Extensions

Edited and extended by Robert G. Wilson v, Feb 21 2002
Corrected by Don Reble, Jan 17 2007

A065587 Smallest prime beginning with exactly n 4's.

Original entry on oeis.org

2, 41, 443, 4441, 44449, 444443, 44444453, 444444421, 444444443, 4444444447, 44444444441, 444444444443, 44444444444459, 444444444444421, 4444444444444423, 44444444444444411, 444444444444444413, 4444444444444444409, 44444444444444444479, 44444444444444444447
Offset: 0

Views

Author

Robert G. Wilson v, Nov 28 2001

Keywords

Crossrefs

Extensions

Offset corrected by Sean A. Irvine, Sep 06 2023

A065588 Smallest prime beginning with exactly n 5's.

Original entry on oeis.org

2, 5, 557, 5557, 555521, 555557, 55555517, 55555553, 5555555501, 5555555557, 5555555555057, 555555555551, 5555555555551, 555555555555529, 555555555555557, 55555555555555519, 5555555555555555021, 555555555555555559, 55555555555555555567, 5555555555555555555087
Offset: 0

Views

Author

Robert G. Wilson v, Nov 28 2001

Keywords

Crossrefs

Cf. A037063, A065584 - A065592. Different from A068105.

Programs

  • Python
    from sympy import isprime
    def a(n):
      if n < 2: return list([2, 5])[n]
      n5s, i, pow10, end_digits = int('5'*n), 1, 1, 0
      while True:
        i = 1
        while i < pow10:
          istr = str(i)
          if istr[0] == '5' and len(istr) == end_digits:
            i += 2 if pow10 <= 10 else pow10 // 10
          else:
            t = n5s * 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, Feb 05 2021, corrected Mar 03 2021

Extensions

Corrected by N. J. A. Sloane, Jan 11 2007 and by Don Reble, Jan 17 2007
Offset corrected by Michael S. Branicky, Feb 05 2021
Showing 1-10 of 16 results. Next