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

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

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

A065580 Smallest prime ending in exactly n 3's.

Original entry on oeis.org

3, 233, 2333, 23333, 733333, 10333333, 83333333, 1033333333, 17333333333, 23333333333, 2633333333333, 10333333333333, 53333333333333, 3233333333333333, 1333333333333333, 23333333333333333, 2033333333333333333, 10333333333333333333, 173333333333333333333, 1733333333333333333333
Offset: 1

Views

Author

Robert G. Wilson v, Nov 28 2001

Keywords

Crossrefs

Programs

  • Mathematica
    Do[a = Table[3, {n} ]; k = 0; While[ b = FromDigits[ Join[ IntegerDigits[k], a]]; Mod[k, 10] == 3 || !PrimeQ[b], k++ ]; Print[b], {n, 1, 17} ]
  • PARI
    a(n)={ my(t=10^n, b=(t-1)/3, d=0); while (!isprime(b + t*d), d++; if(d%10==3, d++)); b + t*d } \\ Harry J. Smith, Oct 23 2009

A065589 Smallest prime beginning with exactly n 6's.

Original entry on oeis.org

2, 61, 661, 6661, 666607, 666667, 66666629, 66666667, 666666667, 6666666661, 66666666667, 6666666666629, 66666666666629, 666666666666631, 66666666666666047, 66666666666666601, 6666666666666666059, 666666666666666661, 66666666666666666601, 66666666666666666667
Offset: 0

Views

Author

Robert G. Wilson v, Nov 28 2001

Keywords

Crossrefs

Programs

  • Mathematica
    Do[a = Table[6, {n}]; k = 0; While[b = FromDigits[ Join[a, IntegerDigits[k] ]]; First[ IntegerDigits[k]] == 6 || !PrimeQ[b], k++ ]; Print[b], {n, 1, 17} ]
  • PARI
    a(n) = {if(n==0, return(2)); my(cs = 60*(10^n\9), pow10 = 10); for(i = 1, oo, np = cs; d = 0; while(d < pow10, np = nextprime(np + 1); d = np - cs; if(d < pow10 && digits(d)[1] != 6 || 10*d < pow10, return(np))); cs*=10; pow10*=10)} \\ David A. Corneth, Sep 06 2023

Extensions

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

A123568 Prime numbers of the form (10^n - 7)/3.

Original entry on oeis.org

31, 331, 3331, 33331, 333331, 3333331, 33333331, 333333333333333331, 3333333333333333333333333333333333333331, 33333333333333333333333333333333333333333333333331
Offset: 1

Views

Author

Artur Jasinski, Nov 12 2006

Keywords

Comments

The number of initial 3s is n - 1.
Note that each n from 2 to 8 gives primes, but after that the n that correspond to primes are progressively further apart. Singh (1997) gives this as an example of why mathematicians don't trust a preponderance of evidence as proof: in the 17th century, when factoring numbers with as few as eight digits wasn't as easy as it is today, the pattern suggested that all numbers of this form are prime. - Alonso del Arte, Nov 11 2012

Examples

			a(7) = 33333331 because that is the seventh number of the specified form to be prime.
333333331 is not in the sequence because it is composite, being the product of 17 and 19607843.
		

References

  • Simon Singh, Fermat's Enigma. New York: Walker & Company (1997) p. 159.

Crossrefs

Programs

  • Mathematica
    Do[If[PrimeQ[(10^n - 7)/3], Print[(10^n - 7)/3]], {n, 1, 100}] (* Jasinski *)
    Select[(10^Range[50] - 7)/3, PrimeQ[#] &] (* Alonso del Arte, Nov 11 2012 *)
    Select[Table[FromDigits[PadLeft[{1},n,3]],{n,50}],PrimeQ] (* Harvey P. Dale, Dec 05 2018 *)
  • PARI
    select(ispseudoprime, vector(20, n, (10^n-7)/3)) \\ Charles R Greathouse IV, Nov 12 2012
Showing 1-5 of 5 results.