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-6 of 6 results.

A037059 Smallest prime containing exactly n 3's.

Original entry on oeis.org

2, 3, 233, 2333, 23333, 313333, 3233333, 31333333, 333233333, 3233333333, 23333333333, 333313333333, 3333333333383, 33133333333333, 323333333333333, 1333333333333333, 23333333333333333, 333333133333333333, 3333313333333333333, 33313333333333333333
Offset: 0

Views

Author

Patrick De Geest, Jan 04 1999

Keywords

Comments

For almost all n >= 0, a(n) equals [10^(n+1)/3] with one of the (first) digits 3 replaced by a digit 1 or 2. We conjecture that in the few other cases (e.g., for n = 12, 119, ...) the statement holds with some digit 3 replaced by a digit among {4, 5, 7, 8}, except for the special case a(1) = 3. - M. F. Hasler, Feb 22 2016

Crossrefs

Programs

  • 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, 3], {n, 1, 18}]
    Table[Sort[Flatten[Table[Select[FromDigits/@Permutations[Join[{n},PadRight[{},i,3]]], PrimeQ],{n,0,9}]]][[1]],{i,20}] (* Harvey P. Dale, Feb 28 2015 *)
  • PARI
    A037059(n)={if(n==1,3,my(t=10^(n+1)\3); forvec(v=[[-1, n], [-2, -1]], ispseudoprime(p=t+10^(n-v[1])*v[2]) && return(p)); forvec(v=[[0, n], [1, 5]], ispseudoprime(p=t+10^v[1]*v[2]) && return(p)))} \\ M. F. Hasler, Feb 22 2016

Formula

a(n) = prime(A037058(n)). - Amiram Eldar, Jul 21 2025

Extensions

More terms from Antonio G. Astudillo (afg_astudillo(AT)lycos.com), Mar 23 2003
More terms and a(0) = 2 prefixed by M. F. Hasler, Feb 22 2016

A065582 Smallest prime ending in exactly n 9's.

Original entry on oeis.org

19, 199, 1999, 49999, 199999, 2999999, 19999999, 799999999, 10999999999, 59999999999, 1099999999999, 34999999999999, 59999999999999, 499999999999999, 14999999999999999, 139999999999999999, 1099999999999999999, 20999999999999999999, 29999999999999999999, 2099999999999999999999
Offset: 1

Views

Author

Robert G. Wilson v, Nov 28 2001

Keywords

Comments

From Jeppe Stig Nielsen, Jul 30 2022: (Start)
Can decrease, for example a(25) < a(24). So not the same as Smallest prime ending in n or more 9s.
a(n) can contain other 9s as well, for example a(46), a(118), a(156). (End)

Crossrefs

Programs

  • Mathematica
    Do[a = Table[9, {n} ]; k = 0; While[ b = FromDigits[ Join[ IntegerDigits[k], a]]; Mod[k, 10] == 9 || !PrimeQ[b], k++ ]; Print[b], {n, 1, 17} ]
  • PARI
    a(n)={ my(t=10^n, b=t-1, d=0); while(!isprime(b + t*d), d++; if(d%10==9, d++)); b + t*d } \\ Harry J. Smith, Oct 23 2009
    
  • Python
    from sympy import isprime
    def a(n):
        pow, end, i = 10**n, 10**n-1, 1
        while i%10 == 9 or not isprime(i*pow + end): i += 1
        return i*pow + end
    print([a(n) for n in range(1, 20)]) # Michael S. Branicky, Jul 30 2022

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

A065581 Smallest prime ending in exactly n 7's.

Original entry on oeis.org

7, 277, 1777, 47777, 2477777, 16777777, 137777777, 577777777, 1777777777, 67777777777, 377777777777, 16777777777777, 17777777777777, 577777777777777, 2777777777777777, 157777777777777777, 377777777777777777, 2777777777777777777, 97777777777777777777, 2477777777777777777777
Offset: 1

Views

Author

Robert G. Wilson v, Nov 28 2001

Keywords

Crossrefs

Programs

  • Mathematica
    Do[a = Table[7, {n} ]; k = 0; While[ b = FromDigits[ Join[ IntegerDigits[k], a]]; Mod[k, 10] == 7 || !PrimeQ[b], k++ ]; Print[b], {n, 1, 17} ]
    k7[n_]:=Module[{c=FromDigits[PadRight[{},n,7]],k=0},While[Nand[PrimeQ[k*10^n + c], Mod[k, 10] != 7],k++];k*10^n+c]; Array[k7,20] (* Harvey P. Dale, Jan 29 2013 *)
  • PARI
    a(n)={ my(t=10^n, b=7*(t-1)/9, d=0); while (!isprime(b + t*d), d++; if(d%10==7, d++)); b + t*d } \\ Harry J. Smith, Oct 23 2009

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

A176183 Smallest prime p = p(n) ending with exactly n strings "13".

Original entry on oeis.org

13, 21313, 4131313, 1213131313, 81313131313, 1131313131313, 613131313131313, 21313131313131313, 8131313131313131313, 113131313131313131313, 171313131313131313131313, 23131313131313131313131313
Offset: 1

Views

Author

Eva-Maria Zschorn (e-m.zschorn(AT)zaschendorf.km3.de), Apr 11 2010

Keywords

Comments

See references of A176096.
List of prefixes: for 1st term p(1) = 13: ./., 2, 4, 12, 8, 1, 6, 2, 8, 1, 17, 23, 21, 8, 59, 87, 53, 46, 10, 8, 20, 73, 29, 20, 3, 2, 16, 33, 80, 2, ...

Examples

			n = 1: prime(6) = 13 is 1st term of sequence.
n = 2: prime(2392) = 21313 is 2nd term of sequence.
Note: 1st such palindromic prime (i.e. prefix 3): p(25) = 3(13)_25 = 313131313131313131313131313131313131313131313131313.
		

Crossrefs

Showing 1-6 of 6 results.