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 18 results. Next

A034388 Smallest prime containing at least n consecutive identical digits.

Original entry on oeis.org

2, 11, 1117, 11113, 111119, 2999999, 11111117, 111111113, 1777777777, 11111111113, 311111111111, 2111111111111, 17777777777777, 222222222222227, 1333333333333333, 11111111111111119, 222222222222222221, 1111111111111111111, 1111111111111111111
Offset: 1

Views

Author

Keywords

Comments

For n in A004023, a(n) = A002275(n). For all other n > 1, a(n) has at least n+1 digits and is (for small n) often of the form a*10^n + b*(10^n-1)/9 or a*(10^n-1)/9*10 + b, with 1 <= a <= 9 and b in {1, 3, 7, 9}. However, for n = 24, 46, 48, 58, 60, 64, 66, ..., more digits are required. Only then a(n) can have a digit 0, and if it has, '0' is often the repeated digit. The first indices where a(n) has more than n+2 digits are n = 208, 277, 346, ... - M. F. Hasler, Feb 25 2016; corrected by Robert Israel, Feb 26 2016

Examples

			a(1) = 2 because this is the smallest prime.
a(2) = 11 because this repunit with n=2 digits is prime.
a(3) = 1117 is the smallest prime with 3 repeated digits.
a(19) = (10^19-1)/9 = R(19) is again a repunit prime. Since all primes with 18 consecutive repeated digits have at least 19 digits, also a(18) = a(19). The same happens for a(22) = a(23).
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local d, k,x,y,z,xs,ys,zs,c,cands;
      for d from n do
        cands:= NULL;
        for k from 0 to d-n do
          if k = 0 then zs:= [0] else zs:= [seq(i,i=1..10^k-1,2)] fi;
          if d=n+k then xs:= [0]; ys:= [$1..9] else xs:= [$10^(d-k-n-1)..10^(d-k-n)-1]; ys:= [$0..9] fi;
          cands:= cands, seq(seq(seq(z + 10^k*y*(10^n-1)/9 + x*10^(k+n), x = xs),y=ys),z=zs);
        od;
        cands:= sort([cands]);
        for c in cands do if isprime(c) then return(c) fi od;
      od
    end proc:
    map(f, [$1..30]); # Robert Israel, Feb 26 2016
  • Mathematica
    With[{s = Length /@ Split@ IntegerDigits@ # & /@ Prime@ Range[10^6]}, Prime@ Array[FirstPosition[s, #][[1]] &, Max@ Flatten@ s]] (* Michael De Vlieger, Aug 15 2018 *)
  • PARI
    A034388(n)={for(d=0,9, my(L=[],k=0); for(a=0,10^d-1,a<10^k||k++; L=setunion(L,vector(10-!a,c,[a*10^n+10^n\9*(c-(a>0)),1])*10^(d-k)));for(i=1,#L,if(L[i][2]>1, L[i][1]+L[i][2]>L[i][1]=nextprime(L[i][1]),ispseudoprime(L[i][1]))&&return(L[i][1])))} \\ M. F. Hasler, Feb 28 2016

Extensions

Edited by M. F. Hasler, Feb 25 2016
Edited by Robert Israel, Feb 26 2016

A037053 Smallest prime containing exactly n 0's.

Original entry on oeis.org

2, 101, 1009, 10007, 100003, 1000003, 20000003, 100000007, 1000000007, 30000000001, 100000000003, 2000000000003, 40000000000001, 1000000000000037, 6000000000000001, 20000000000000003, 100000000000000003, 1000000000000000003, 60000000000000000007, 500000000000000000003
Offset: 0

Views

Author

Patrick De Geest, Jan 04 1999

Keywords

Comments

Certain entries require n+3 digits such as a(13). Those which do not require three digits besides n zeros are in A085824. Conjecture: a prime of this form, A037053, requires at most three judiciously placed nonzero digits, two on the exterior and one inside. - Robert G. Wilson v
The zeros in a(n) do not need to be consecutive. If the zeros must be consecutive we get a new sequence which agrees with this one up though a(31), but then here we have a(32) = 10000000000000000000000000000000603, whereas the smallest prime with exactly 32 consecutive zeros is 19000000000000000000000000000000009 = 19*10^33+9. - N. J. A. Sloane, Feb 20 2016
Sequence A269230 lists the indices (32, 43, 46, 49, 50, 60, 69, ...) for which a(n) does not have n consecutive digits '0', and gives more information about the smallest prime which has n consecutive digits '0': Sequence A269260 lists the values a > 9 such that the least prime with n *consecutive* '0's equals nextprime(a*10^(n+1)), for these indices n. - M. F. Hasler, Feb 20 2016 and Feb 22 2016
Since the definition requires "exactly" and not "at least" n 0's, the sequence is not increasing, e.g., a(22) = 10^24 + 49 > a(23) = 10^24 + 7. However, it seems that no term has more digits than its successor. - M. F. Hasler, Feb 20 2016
From Bob Selcoe, Feb 20 2016: (Start)
Conjecture 1: (following Robert G. Wilson v's conjecture above and insight provided by Hans Havermann): terms with two substrings of zeros have first digit of 1.
Conjecture 2: as n increases, there are more terms with two substrings of zeros than one consecutive string.
The logic is as follows: Let n = number of zeros and z = number of substrings of consecutive zeros contained in candidate primes. Candidates with two substrings of zeros (z=2) must be considered after only 72 smaller z=1 candidates have been considered and excluded, i.e., numbers of the form a[n zeros]b and 1[n zeros]ab, where a in {1..9}, b in {1,3,7,9}. After these 72 candidates are excluded, 36*n z=2 candidates are considered before having to consider only 36 additional z=1 candidates (i.e., 2[n zeros]ab), followed by 36*n additional z=2 candidates, etc. So as n increases, it becomes increasingly unlikely that any z=1 term appears. Additionally, the number of candidates increases as n increases for z>=3. For a given n, 1044 + 324*(n+1) candidates must be excluded before considering the smallest z=3: 1[n-2 zeros]10101. Since the probability p of n-digit primes occurring is p ~ 1/(n log 10) by the Prime Number Theorem, and the number of z in {1,2} candidates which must be excluded increases exponentially as n and z increase, it is unlikely that any z >= 3 term appears in A037053 and that first digit will be > 1 for any z=2 term.
Sequence A269233 lists the number of candidate primes < a(n); i.e., the number of excluded candidates.
(End)

Crossrefs

Cf. A037052, A034388, A085824. Least prime with n '1's,...,'9's: A037055, A037057, A037059, A037061, A037063, A037065, A037067, A037069, A037071. The indices of these primes are given in A037052 - A037070.
Cf. A269230, A269233 (number of candidate primes < a(n)), A269260.

Programs

  • Maple
    F:= proc(n)
    local a,b,cands,p;
    cands:= [seq(seq(10^(n+1)*a+b,b=[1,3,7,9]),a=1..9), seq(seq(seq(10^(n+2)+a*10^j+b,b=[1,3,7,9]),a=1..9),j=1..n+1)];
    for p in cands do if isprime(p) then return p fi od;
    error("No candidate is prime");
    end proc:
    2, seq(F(n),n=1..40); # Robert Israel, Feb 19 2016
  • Mathematica
    f[n_] := Block[{pc}, a = 1; While[a < 10, b = 1; While[b < 10, pc = a*10^(n + 1) + b; If[PrimeQ[pc], Goto[fini]]; b += 2]; a++]; e = 1; While[e < n + 2, b = 1; While[b < 10, c = 1; While[c < 10, pc = 10^(n + 2) + b*10^e + c; If[ PrimeQ[pc], Goto[ fini]]; c += 2]; b++]; e++]; Label[ fini]; pc]; f[0] = 2; Array[f, 25, 0] (* Robert G. Wilson v, Feb 21 2016 *)
  • PARI
    A037053(n)={n&&forstep(i=n=10^(n+1),9*n,n,nextprime(i)p*=10, forstep(j=i+p,i+9*p,p,nextprime(j)M. F. Hasler, Feb 19 2016

Formula

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

Extensions

More terms from Victoria A Sapko (vsapko(AT)canes.gsw.edu), Aug 16 2002
Edited by Robert G. Wilson v, Jul 04 2003
Sequence rechecked (by request) and edited by Charles R Greathouse IV, Aug 03 2010
Extended with a(0) = 2 and three lines of data completed by M. F. Hasler, Feb 19 2016

A037071 Smallest prime containing exactly n 9's.

Original entry on oeis.org

2, 19, 199, 1999, 49999, 199999, 2999999, 19999999, 799999999, 9199999999, 59999999999, 959999999999, 9919999999999, 59999999999999, 499999999999999, 9299999999999999, 99919999999999999, 994999999999999999, 9991999999999999999, 29999999999999999999, 989999999999999999999
Offset: 0

Views

Author

Patrick De Geest, Jan 04 1999

Keywords

Comments

We conjecture that for all n >= 0, a(n) equals [10^(n+1)/9]*9 with one of the (first) digits 9 replaced by a digit among {1, 2, 4, 5, 7, 8}. - 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, 9], {n, 1, 20}]
  • PARI
    A037071(n)={my(t=10^(n+1)\9*9); forvec(v=[[-1, n], [-8, -1]], ispseudoprime(p=t+10^(n-v[1])*v[2]) && return(p));error} \\ M. F. Hasler, Feb 22 2016

Formula

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

Extensions

More terms from Vladeta Jovovic, Jan 10 2002
a(0) = 2 prepended by M. F. Hasler, Feb 22 2016

A037067 Smallest prime containing exactly n 7's.

Original entry on oeis.org

2, 7, 277, 1777, 47777, 727777, 7477777, 77767777, 577777777, 1777777777, 67777777777, 377777777777, 7177777777777, 17777777777777, 577777777777777, 2777777777777777, 77777767777777777, 377777777777777777, 2777777777777777777, 71777777777777777777
Offset: 0

Views

Author

Patrick De Geest, Jan 04 1999

Keywords

Comments

We conjecture that for all n >= 2, a(n) equals floor(10^(n+1)/9)*7 with one of the (first) digits 7 replaced by a digit among {0, ..., 6}. - M. F. Hasler, Feb 22 2016
The conjecture is false: a(668) = 7*(10^669-1)/9 + 10^276. - Robert Israel, Jul 13 2016

Crossrefs

Programs

  • Maple
    F:= proc(n) local x0,i,j;
      x0:= 7/9*(10^(n+1)-1);
      for j from 1 to 6 do
        if isprime(x0 + (j-7)*10^n) then
          return x0 + (j-7)*10^n fi od;
      for i from n-1 to 0 by -1 do
        for j from 0 to 6 do
         if isprime(x0 + (j-7)*10^i) then
           return x0 + (j-7)*10^i fi od od;
      for i from 0 to n do
        for j from 8 to 9 do
           if isprime(x0 + (j-7)*10^i) then
             return x0 + (j-7)*10^i fi
      od od:
    end proc:
    F(0):= 2: F(1):= 7:
    map(F, [$0..100]); # Robert Israel, Jul 13 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, 7], {n, 1, 18}]
  • PARI
    A037067(n)={my(t=10^(n+1)\9*7); forvec(v=[[-1, n], [-7, -1]], ispseudoprime(p=t+10^(n-v[1])*v[2]) && return(p)); error} \\ M. F. Hasler, Feb 22 2016

Formula

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

Extensions

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

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

A037057 Smallest prime containing exactly n 2's.

Original entry on oeis.org

3, 2, 223, 2221, 22229, 1222229, 20222227, 22222223, 222222227, 20222222221, 22222222223, 2122222222229, 21222222222221, 22222222222229, 222222222222227, 21222222222222221, 202222222222222229, 222222222222222221, 22222202222222222221, 220222222222222222229, 2202222222222222222229
Offset: 0

Views

Author

Patrick De Geest, Jan 04 1999

Keywords

Comments

For n > 1, the last digit cannot be 2, so a(n) has at least n+1 digits. The probability is big that none of [10^n/9]*20 + {1,3,7,9} is prime, in which case a(n) must have at least n+2 digits. This is the most frequent case. We can even conjecture that for all n > 1, a(n) equals [10^(n+1)/9]*20 + b with 1 <= b <= 9 and one of the (first) digits 2 replaced by 0 or 1. - 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, 2], {n, 1, 18}]
  • PARI
    A037057(n)={my(p,t=10^(n+1)\9*20); n>1 && forvec(v=[[-1,n],[-2,-1]],nextprime(p=t+10^(n-v[1])*v[2])-p<10 && return(nextprime(p)));3-n} \\ M. F. Hasler, Feb 22 2016

Formula

a(n) = prime(A037056(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) = 3 from M. F. Hasler, Feb 22 2016

A037063 Smallest prime containing exactly n 5's.

Original entry on oeis.org

2, 5, 557, 5557, 155557, 555557, 15555557, 55555553, 3555555551, 5555555557, 525555555557, 555555555551, 5555555555551, 355555555555559, 555555555555557, 51555555555555551, 545555555555555551, 555555555555555559, 15555555555555555557, 155555555555555555551
Offset: 0

Views

Author

Patrick De Geest, Jan 04 1999

Keywords

Comments

For n > 1, the last digit of n cannot be 5, therefore a(n) must have at least n+1 digits. It is probable that none among [10^n/9]*50 + {1,3,7,9} is prime in which case a(n) must have n+2 digits. We conjecture that for all n > 1, a(n) equals [10^(n+1)/9]*50 + b with 1 <= b <= 9 and one of the (first) digits 5 replaced by a 0, 1, 2, 3 or 4. - 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, 5], {n, 1, 18}]
  • PARI
    A037063(n)={my(p, t=10^(n+1)\9*50); n>1 && forvec(v=[[-1, n], [-5, -1]], nextprime(p=t+10^(n-v[1])*v[2])-p<10 && return(nextprime(p)));1+4^n} \\ M. F. Hasler, Feb 22 2016

Formula

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

Extensions

More terms from Randall L Rathbun, Jan 11 2002
Edited and corrected by Robert G. Wilson v, Jul 04 2003
More terms and a(0) = 2 from M. F. Hasler, Feb 22 2016

A037065 Smallest prime containing exactly n 6's.

Original entry on oeis.org

2, 61, 661, 6661, 166667, 666667, 16666669, 66666667, 666666667, 6666666661, 66666666667, 1666666666661, 36666666666661, 166666666666667, 3666666666666667, 16666666666666661, 616666666666666661, 666666666666666661, 36666666666666666661, 66666666666666666667
Offset: 0

Views

Author

Patrick De Geest, Jan 04 1999

Keywords

Comments

Note that a(11) is palindromic.
The last digit of n cannot be 6, therefore a(n) must have at least n+1 digits. It is probable that none among [10^n/9]*60 + {1,3,7,9} is prime in which case a(n) must have n+2 digits. We conjecture that for all n >= 0, a(n) equals [10^(n+1)/9]*60 + b with 1 <= b <= 9 and one of the (first) digits 6 replaced by a digit among {0, 1, 2, 3, 4, 5}. - 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, 6], {n, 1, 17}]
  • PARI
    A037065(n)={my(p, t=10^(n+1)\9*60); forvec(v=[[-1, n], [-6, -1]], nextprime(p=t+10^(n-v[1])*v[2])-p<10 && return(nextprime(p)))} \\ M. F. Hasler, Feb 22 2016

Formula

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

Extensions

More terms from Hans Havermann, Jun 16 2001
More terms and a(0) = 2 from M. F. Hasler, Feb 22 2016

A037061 Smallest prime containing exactly n 4's.

Original entry on oeis.org

2, 41, 443, 4441, 44449, 444443, 24444443, 424444441, 444444443, 4444444447, 44444444441, 444444444443, 14444444444449, 440444444444441, 2444444444444447, 44044444444444441, 424444444444444447, 4344444444444444449, 42444444444444444443, 44444444444444444447
Offset: 0

Views

Author

Patrick De Geest, Jan 04 1999

Keywords

Comments

The last digit of n cannot be 4, therefore a(n) must have at least n+1 digits. It is probable that none among [10^n/9]*40 + {1,3,7,9} is prime in which case a(n) must have n+2 digits. We conjecture that for all n >= 0, a(n) equals [10^(n+1)/9]*40 + b with 1 <= b <= 9 and one of the (first) digits 4 replaced by a 0, 1, 2 or 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, 4], {n, 1, 18}]
  • PARI
    A037061(n)={my(p, t=10^(n+1)\9*40); forvec(v=[[-1, n], [-4, -1]], nextprime(p=t+10^(n-v[1])*v[2])-p<10 && return(nextprime(p)))} \\ M. F. Hasler, Feb 22 2016

Formula

a(n) = prime(A037060(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 from M. F. Hasler, Feb 22 2016

A037069 Smallest prime containing exactly n 8's.

Original entry on oeis.org

2, 83, 881, 8887, 88883, 888887, 28888883, 88888883, 888888883, 48888888883, 288888888889, 888888888887, 48888888888883, 88888888888889, 888888888888883, 18888888888888883, 88888888888888889, 2888888888888888887, 8888888888888888881, 388888888888888888889
Offset: 0

Views

Author

Patrick De Geest, Jan 04 1999

Keywords

Comments

The last digit of n cannot be 8, therefore a(n) must have at least n+1 digits. It is probable (using [] for floor) that none among [10^n/9]*80 + {1,3,7,9} is prime in which case a(n) must have n+2 digits. We conjecture that for all n >= 0, a(n) equals [10^(n+1)/9]*80 + b with 1 <= b <= 9 and one of the (first) digits 8 replaced by a digit among {0, ..., 7}. - 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, 8], {n, 1, 18}]
  • PARI
    A037069(n)={my(p, t=10^(n+1)\9*80); forvec(v=[[-1, n], [-8, -1]], nextprime(p=t+10^(n-v[1])*v[2])-p<10 && return(nextprime(p)))} \\ ~

Formula

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

Extensions

Corrected by Jud McCranie, Jan 04 2001
More terms from Erich Friedman, Jun 03 2001
More terms and a(0) = 2 from M. F. Hasler, Feb 22 2016
Showing 1-10 of 18 results. Next