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.

Previous Showing 11-18 of 18 results.

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

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

A037070 a(n)-th prime is the smallest prime containing exactly n 9's.

Original entry on oeis.org

1, 8, 46, 303, 5133, 17984, 216816, 1270607, 41146179, 420243162, 2524038155, 36159205628, 343392568900, 1955010428258, 15237833654620, 260219446617109, 2621513397605657, 24619309639366177, 233874804775621799, 684559920583084690, 20920441130654929928, 200085344903558463823
Offset: 0

Views

Author

Patrick De Geest, Jan 04 1999

Keywords

Crossrefs

Programs

  • Mathematica
    (* see A037071 for f *) PrimePi[ Table[ f[n, 9], {n, 1, 13}]]

Formula

a(n) = A000720(A037071(n)). - Amiram Eldar, Jul 21 2025

Extensions

One more term from Vladeta Jovovic, Jan 10 2002
a(0)=1 prepended by Sean A. Irvine, Dec 06 2020
a(14)-a(21) calculated using Kim Walisch's primecount and added by Amiram Eldar, Jul 21 2025

A268707 Smallest n-digit prime having at least n-1 digits equal to 9.

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
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    f[n_] := Block[{k = 0, p = {}, r = (10^n - 1), s = Range@ 10 - 10}, While[k < n - 0, AppendTo[p, Select[r + 10^k*s, PrimeQ]]; k++]; p = Min@ Flatten@ p]; Array[f, 20]
  • PARI
    a(n)=my(t=10^n-1,p); forstep(d=n-1,0,-1, forstep(k=8,1,-1, p=t-10^d*k; if(ispseudoprime(p), return(p)))); -1 \\ Charles R Greathouse IV, Mar 21 2016

A178007 Largest n-digit prime with the most digits equal to 9.

Original entry on oeis.org

7, 97, 997, 9949, 99991, 999979, 9999991, 99999989, 999999929, 9999999929, 99999999599, 999999999989, 9999999999799, 99999999999959, 999999999999989, 9999999999999199, 99999999999999997, 999999999999999989, 9999999999999999919, 99999999999999999989, 999999999999999999899, 9999999999999999999929
Offset: 1

Views

Author

Lekraj Beedassy, May 17 2010

Keywords

Comments

First maximum the number of 9's, then choose the largest.
From Robert Israel, Dec 18 2024: (Start)
This is believed to be different from A241206, as there should be infinitely many n for which there is no n-digit prime with n-1 digits equal to 9. No examples are known; the least such n is greater than 3400. (End)

Crossrefs

Programs

  • Maple
    f:= proc(n) local i,j,a,b,x,y;
         x:= 10^n-1;
         for i from 0 to n-1 do
           for a from 1 to 9 do
             y:= x - a*10^i;
             if isprime(y) then return y fi;
         od od;
         for i from 1 to n-1 do
           for a from 1 to 9 do
             for j from 0 to i-1 do
               for b from 1 to 9 do
                 y:= x - a*10^i - b*10^j;
                 if isprime(y) then return y fi
        od od od od;
        FAIL
    end proc:
    map(f, [$1..30]); # Robert Israel, Dec 16 2024

Extensions

Corrected and more terms by Robert Israel, Dec 16 2024

A375760 Array read by rows: T(n,k) is the first prime with exactly n occurrences of decimal digit k.

Original entry on oeis.org

2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 101, 13, 2, 3, 41, 5, 61, 7, 83, 19, 1009, 11, 223, 233, 443, 557, 661, 277, 881, 199, 10007, 1117, 2221, 2333, 4441, 5557, 6661, 1777, 8887, 1999, 100003, 10111, 22229, 23333, 44449, 155557, 166667, 47777, 88883, 49999, 1000003, 101111, 1222229, 313333, 444443, 555557, 666667, 727777, 888887, 199999
Offset: 0

Views

Author

Robert Israel, Aug 27 2024

Keywords

Examples

			T(4,1) = 10111 because 10111 is the first prime with four 1's.
Array starts
      2      2       3      2      2      2      2      2      2      2
    101     13       2      3     41      5     61      7     83     19
   1009     11     223    233    443    557    661    277    881    199
  10007   1117    2221   2333   4441   5557   6661   1777   8887   1999
 100003  10111   22229  23333  44449 155557 166667  47777  88883  49999
1000003 101111 1222229 313333 444443 555557 666667 727777 888887 199999
		

Crossrefs

Programs

  • Maple
    F:= proc(v,x) local d,y,z,L,S,SS,Cands,t,i,k;
       for d from v do
         Cands:= NULL;
         if x = 0 then SS:= combinat:-choose([$2..d-1],v)
         elif member(x,[1,3,7,9]) then SS:= combinat:-choose(d,v)
         else SS:= combinat:-choose([$2..d],v)
         fi;
         for S in SS do
           for y from 9^(d-v+1) to 9^(d-v+1)+9^(d-v)-1 do
             L:= convert(y,base,9)[1..d-v+1];
             L:= map(proc(s) if s < x then s else s+1 fi end proc, L);
             i:= 1;
             t:= 0:
             for k from 1 to d do
               if member(k,S) then t:= t + x*10^(k-1)
               else t:= t + L[i]*10^(k-1); i:= i+1;
               fi;
             od;
             Cands:= Cands, t
         od od;
         Cands:= sort([Cands]);
         for t in Cands do if isprime(t) then return t fi od;
       od
    end proc:
    F(0,0):= 2: F(1,2):= 2: F(1,5):= 5:
    for i from 0 to 10 do
      seq(F(i,x), x=0..9)
    od;
  • Mathematica
    T[n_,k_]:=Module[{p=2},While[Count[IntegerDigits[p],k]!=n, p=NextPrime[p]]; p]; Table[T[n,k],{n,0,5},{k,0,9}]//Flatten (* Stefano Spezia, Aug 27 2024 *)

A120642 Smallest integer k>0 such that k*10^n - 1 is a prime.

Original entry on oeis.org

2, 2, 2, 5, 2, 3, 2, 8, 11, 6, 11, 35, 6, 5, 15, 14, 11, 21, 3, 21, 14, 6, 6, 80, 8, 2, 2, 6, 9, 48, 48, 21, 15, 6, 44, 11, 9, 15, 18, 6, 33, 30, 3, 278, 74, 92, 89, 33, 8, 71, 59, 11, 2, 5, 3, 24, 108, 47, 39, 41, 6, 14, 53, 173, 26, 26, 51, 114, 23, 17, 246, 44, 6, 131, 56, 8, 26, 77, 74
Offset: 1

Views

Author

Jonathan Vos Post, Aug 17 2006

Keywords

Examples

			The primes are 19, 199, 1999, 49999, 199999, 2999999,
19999999, 799999999, 10999999999, 59999999999, ...,.
		

Crossrefs

Programs

  • Mathematica
    f[n_] := Block[{k = 1}, While[ !PrimeQ[k*10^n - 1], k++ ]; k]; Array[f, 79] (* Robert G. Wilson v *)

Extensions

a(11) onwards from Robert G. Wilson v, Aug 20 2006

A120729 Smallest integer k>0 such that k*10^n + 1 is a semiprime.

Original entry on oeis.org

3, 2, 2, 5, 1, 1, 1, 1, 1, 2, 4, 2, 3, 7, 4, 3, 6, 6, 4, 1, 2, 4, 13, 2, 4, 3, 7, 21, 6, 9, 3, 1, 5, 4, 16, 19, 28, 19, 9, 3
Offset: 0

Views

Author

Jonathan Vos Post, Aug 17 2006

Keywords

Comments

The corresponding semiprimes are 4, 21, 201, 5001, 10001, 100001, 100001, 10000001, 2000000001, 40000000001, ... Semiprime analog of A121172.

Examples

			a(0) = 3 because 3*10^0 + 1 = 4 = 2^2 is a semiprime.
a(1) = 2 because 2*10^1 + 1 = 21 = 3*7 is a semiprime.
a(2) = 2 because 2*10^2 + 1 = 201 = 3*67 is a semiprime.
a(3) = 5 because 5*10^3 + 1 = 5001 = 3*1667 is a semiprime.
a(4) = 1 because 1*10^4 + 1 = 10001 = 73*137 is a semiprime.
a(5) = 1 because 1*10^5 + 1 = 100001 = 11*9091 is a semiprime.
		

Crossrefs

Programs

  • Mathematica
    sik[n_]:=Module[{k=1,c=10^n},While[PrimeOmega[k*c+1]!=2,k++];k]; Array[sik,40,0] (* Harvey P. Dale, Aug 20 2012 *)

Formula

Smallest integer k>0 such that k*10^n + 1 is in A001358.

Extensions

More terms from Harvey P. Dale, Aug 20 2012
Previous Showing 11-18 of 18 results.