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

A266142 Number of n-digit primes in which n-1 of the digits are 3's.

Original entry on oeis.org

4, 8, 9, 12, 7, 14, 13, 11, 8, 7, 9, 8, 3, 10, 11, 14, 9, 12, 6, 11, 11, 11, 9, 10, 9, 10, 22, 10, 10, 12, 7, 14, 14, 15, 7, 16, 11, 7, 14, 10, 13, 13, 8, 10, 11, 12, 6, 12, 10, 10, 10, 11, 5, 14, 8, 8, 5, 14, 6, 18, 13, 9, 13, 10, 4, 14, 12, 6, 11, 13, 12, 20, 11, 9, 13, 6, 12, 22, 13, 10, 10, 12, 5, 20, 11, 10, 11, 10, 11, 12, 11, 13, 12, 18, 7, 20, 15, 6, 8, 8, 8, 15, 12, 10, 14
Offset: 1

Views

Author

Keywords

Examples

			a(2) = 8 since 13, 23, 31, 37, 43, 53, 73 and 83 are all primes.
a(3) = 9 since 233, 313, 331, 337, 353, 373, 383, 433 and 733 are all primes.
		

Crossrefs

Programs

  • Mathematica
    f3[n_] := Block[{cnt = k = 0, r = 3 (10^n - 1)/9, s = Range[0, 9] - 3}, While[k < n, cnt += Length@ Select[r + 10^k*s, PrimeQ@ # && IntegerLength@ # > k &]; k++]; cnt]; Array[f3, 105]
  • PARI
    a(n)={sum(i=0 ,n-1, sum(d=i==n-1, 9, isprime((10^n-1)/3 + (d-3)*10^i)))} \\ Andrew Howroyd, Feb 28 2018
    
  • Python
    from _future_ import division
    from sympy import isprime
    def A266142(n):
        return 4*n if (n==1 or n==2) else sum(1 for d in range(-3,7) for i in range(n) if isprime((10**n-1)//3+d*10**i)) # Chai Wah Wu, Dec 27 2015

Extensions

a(2) corrected by Chai Wah Wu, Dec 27 2015
a(2) in b-file corrected as above by Andrew Howroyd, Feb 28 2018

A266146 Number of n-digit primes in which n-1 of the digits are 7's.

Original entry on oeis.org

4, 8, 10, 9, 12, 11, 8, 4, 9, 9, 10, 14, 14, 11, 16, 7, 10, 17, 7, 10, 9, 12, 9, 13, 11, 10, 14, 5, 3, 22, 6, 13, 13, 10, 8, 16, 8, 6, 16, 8, 13, 14, 8, 7, 8, 13, 9, 11, 13, 9, 14, 8, 4, 23, 13, 11, 8, 8, 8, 12, 13, 13, 11, 11, 10, 23, 11, 8, 8, 3, 6, 16, 12, 13, 12, 12, 8, 11, 8, 11, 14, 13, 7, 15, 12, 17, 11, 7, 9, 21, 6, 6, 11, 12, 6, 14, 14, 12, 13, 12, 11, 17, 10, 17, 18
Offset: 1

Views

Author

Keywords

Examples

			a(2) = 8 from 17, 37, 47, 67, 71, 73, 79, 97. - _N. J. A. Sloane_, Dec 27 2015
a(3) = 10 since 277, 577, 677, 727, 757, 773, 787, 797, 877, and 977 are primes.
		

Crossrefs

Programs

  • Mathematica
    f7[n_] := Block[{cnt = k = 0, r = 7 (10^n - 1)/9, s = Range[0, 9] - 7}, While[k < n, cnt += Length@ Select[r + 10^k*s, PrimeQ@ # && IntegerLength@ # > k &]; k++]; cnt]; Array[f7, 100]
  • PARI
    a(n)={sum(i=0, n-1, sum(d=i==n-1, 9, isprime((10^n-1)/9*7 + (d-7)*10^i)))} \\ Andrew Howroyd, Feb 28 2018
    
  • Python
    from _future_ import division
    from sympy import isprime
    def A266146(n):
         return 4*n if (n==1 or n==2) else sum(1 for d in range(-7,3) for i in range(n) if isprime(7*(10**n-1)//9+d*10**i)) # Chai Wah Wu, Dec 27 2015

Extensions

a(2) corrected by Chai Wah Wu, Dec 27 2015
a(2) corrected in b-file as above by Andrew Howroyd, Feb 28 2018

A266141 Number of n-digit primes in which n-1 of the digits are 2's.

Original entry on oeis.org

4, 2, 3, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0
Offset: 1

Views

Author

Keywords

Comments

The leading digits must be 2's and only the trailing digit can vary.
For n large a(n) is usually zero.
a(n) <= 4. If n > 1 and not a multiple of 3, then a(n) <= 2. It appears that a(n) <= 1 for n > 3. - Chai Wah Wu, Dec 26 2015

Examples

			a(3) = 3 since 223, 227 and 229 are all primes.
		

Crossrefs

Programs

  • Mathematica
    d = 2; Array[Length@ Select[d (10^# - 1)/9 + (Range[0, 9] - d), PrimeQ] &, 100]
  • Perl
    use ntheory ":all"; sub a266141 { my $n=shift; return 4 if $n==1; 0+scalar(grep{is_prime("2"x($n-1).$)} 1,3,7,9); } say a266141($) for 1..20; # Dana Jacobsen, Dec 27 2015
  • Python
    from sympy import isprime
    def A266141(n):
        return 4 if n==1 else sum(1 for d in '1379' if isprime(int('2'*(n-1)+d))) # Chai Wah Wu, Dec 26 2015
    

A266143 Number of n-digit primes in which n-1 of the digits are 4's.

Original entry on oeis.org

4, 3, 2, 2, 1, 2, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 1

Views

Author

Keywords

Comments

The leading digits must be 4's and only the trailing digit can vary.
For n large a(n) is usually zero.

Examples

			a(3) = 2 since 443 and 449 are primes.
a(4) = 2 since 4441 and 4447 are primes.
		

Crossrefs

Programs

  • Mathematica
    d = 4; Array[Length@ Select[d (10^# - 1)/9 + (Range[0, 9] - d), PrimeQ] &, 100]
  • Python
    from _future_ import division
    from sympy import isprime
    def A266143(n):
        return 4 if n==1 else sum(1 for d in [-3,-1,3,5] if isprime(4*(10**n-1)//9+d)) # Chai Wah Wu, Dec 27 2015

A266144 Number of n-digit primes in which n-1 of the digits are 5's.

Original entry on oeis.org

4, 2, 1, 1, 0, 1, 0, 2, 0, 1, 0, 2, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 1

Views

Author

Keywords

Comments

The leading digits must be 5's and only the trailing digit can vary.
For n large a(n) is usually zero.

Examples

			a(2) = 2 since 53 and 59 are primes.
a(3) = 1 since 557 is the only prime.
		

Crossrefs

Programs

  • Mathematica
    d = 5; Array[Length@ Select[d (10^# - 1)/9 + (Range[0, 9] - d), PrimeQ] &, 100]
  • Python
    from _future_ import division
    from sympy import isprime
    def A266144(n):
        return 4 if n==1 else sum(1 for d in [-4,-2,2,4] if isprime(5*(10**n-1)//9+d)) # Chai Wah Wu, Dec 27 2015

A266145 Number of n-digit primes in which n-1 of the digits are 6's.

Original entry on oeis.org

4, 2, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 1

Views

Author

Keywords

Comments

The leading digits must be 6's and only the trailing digit can vary.
For n large a(n) is usually zero.

Examples

			a(2) = 2 since 61 and 67 are prime.
a(3) = 1 since 661 is the only prime.
		

Crossrefs

Programs

  • Mathematica
    d = 6; Array[Length@ Select[d (10^# - 1)/9 + (Range[0, 9] - d), PrimeQ] &, 100]
    Join[{4},Table[Count[Table[10FromDigits[PadRight[{},k,6]]+n,{n,{1,3,7,9}}], ?PrimeQ],{k,110}]] (* _Harvey P. Dale, Dec 23 2017 *)
  • Python
    from _future_ import division
    from sympy import isprime
    def A266145(n):
        return 4 if n==1 else sum(1 for d in [-5,-3,1,3] if isprime(2*(10**n-1)//3+d)) # Chai Wah Wu, Dec 27 2015

A266147 Number of n-digit primes in which n-1 of the digits are 8's.

Original entry on oeis.org

4, 2, 3, 1, 1, 1, 0, 1, 2, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 1

Views

Author

Keywords

Comments

The leading digits must be 8's and only the trailing digit can vary.
For n large a(n) is usually zero.

Examples

			a(3) = 3 since 881, 883, and 887 are all primes.
		

Crossrefs

Programs

  • Mathematica
    d = 8; Array[Length@ Select[d (10^# - 1)/9 + (Range[0, 9] - d), PrimeQ] &, 100]
    Join[{4},Table[Count[Table[10FromDigits[PadRight[{},k,8]]+n,{n,{1,3,7,9}}], ?PrimeQ],{k,110}]] (* _Harvey P. Dale, Jun 22 2021 *)
  • Python
    from _future_ import division
    from sympy import isprime
    def A266147(n):
        return 4 if n==1 else sum(1 for d in [-7,-5,-1,1] if isprime(8*(10**n-1)//9+d)) # Chai Wah Wu, Dec 27 2015

A266149 Number of n-digit primes that consist of at least n-1 copies of some decimal digit.

Original entry on oeis.org

4, 21, 46, 43, 40, 53, 35, 49, 40, 38, 44, 52, 35, 45, 49, 42, 38, 57, 28, 45, 38, 47, 38, 52, 33, 45, 56, 38, 36, 65, 29, 56, 48, 40, 38, 58, 37, 33, 57, 40, 37, 61, 41, 39, 37, 44, 36, 55, 47, 43, 47, 43, 35, 62, 43, 46, 29, 35, 37, 56, 39, 41, 46, 48, 39, 74, 45, 34, 34, 35, 34, 67, 39, 45, 43
Offset: 1

Views

Author

Keywords

Comments

The first n at which a(n)=k for k=1...80, or 0 if no such k exists with n < 701: 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 433, 141, 181, 847, 19, 31, 253, 357, 137, 25, 68, 7, 29, 37, 10, 44, 5, 43, 16, 4, 11, 14, 3, 22, 33, 8, 139, 82, 12, 6, 102, 48, 27, 18, 36, 270, 198, 42, 54, 498, 90, 30, 738, 72, 222, 192, 852, 84, 342, 0, 66, 0, 816, 264, 0, 288, 0.

Examples

			a(1) = 4 since 2, 3, 5 and 7 are primes,
a(2) = 21 since 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89 and 97 are primes,
a(3) = 46 since 101, 113, 131, 151, 181, 191, 199, 211, 223, 227, 229, 233, 277, 311, 313, 331, 337, 353, 373, 383, 433, 443, 449, 499, 557, 577, 599, 661, 677, 727, 733, 757, 773, 787, 797, 811, 877, 881, 883, 887, 911, 919, 929, 977, 991, 997 are all primes,
a(4) = 43 since 1117, 1151, 1171, 1181, 1511, 1777, 1811, 1999, 2111, 2221, 2333, 2777, 2999, 3313, 3323, 3331, 3343, 3373, 3433, 3533, 3733, 3833, 4111, 4441, 4447, 4999, 5333, 5557, 6661, 7177, 7333, 7477, 7577, 7717, 7727, 7757, 7877, 8111, 8887, 8999, 9199, 9929 and 9949 are primes; etc.
		

Crossrefs

Programs

  • Mathematica
    Length /@ Array[Function[n, Select[Union[Flatten[Function[k, Select[FromDigits /@ Flatten[Permutations[Flatten@ {Table[k, {n - 1}], #}] & /@ Range[0, 9], 1], PrimeQ]] /@ Range[1, 9]]], Function[m, IntegerLength@ m == n]]], 100] (* Michael De Vlieger, Jan 01 2016 *)
  • Python
    from sympy import isprime
    def a(n):
      if n == 1: return 4
      okset = set()
      for digit1 in "24568":
        for digit2 in "1379":
          t = int(digit1*(n-1) + digit2)
          if isprime(t): okset.add(t)
      for digit1 in "1379":
        for digit2 in "0123456789":
          if ((n-1)*int(digit1) + int(digit2))%3 == 0: continue
          for j in range(n):
            mc = digit1*j + digit2 + digit1*(n-1-j)
            if mc[0] == '0': continue
            t = int(mc)
            if isprime(t): okset.add(t)
      return len(okset)
    print([a(n) for n in range(1, 76)]) # Michael S. Branicky, Apr 21 2021

Formula

a(n) = A265733(n) + A266141(n) + A266142(n) + A266143(n) + A266144(n) + A266145(n) + A266146(n) + A266147(n) + A266148(n) for n>2.

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
Showing 1-10 of 11 results. Next