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

A266148 Number of n-digit primes in which n-1 of the digits are 9's.

Original entry on oeis.org

4, 6, 7, 7, 8, 10, 7, 13, 8, 8, 11, 13, 8, 11, 13, 14, 10, 9, 7, 11, 9, 13, 10, 19, 5, 10, 14, 7, 10, 9, 9, 15, 13, 8, 7, 9, 10, 11, 10, 13, 5, 12, 15, 7, 12, 7, 12, 11, 13, 11, 8, 13, 13, 13, 12, 12, 9, 9, 15, 14, 9, 8, 13, 11, 15, 17, 10, 8, 11, 10, 6, 16, 8, 8, 8, 15, 9, 11, 14, 7, 10, 11, 16, 17, 11, 10, 12, 16, 8, 15, 7, 11, 11, 10, 7, 12, 6, 10, 8, 9
Offset: 1

Views

Author

Keywords

Comments

The other digit cannot be 0, 3, 6, or 9, or else the number would not be prime. - N. J. A. Sloane, May 20 2016

Examples

			a(3) = 7 since 199, 499, 599, 919, 929, 991 and 997 are all the three-digit primes containing two 9's.
		

Crossrefs

Programs

  • Mathematica
    f9[n_] := Block[{cnt = k = 0, r = 9 (10^n - 1)/9, s = Range[0, 9] - 9}, While[k < n, cnt += Length@ Select[r + 10^k * s, PrimeQ@ # && IntegerLength@ # > k &]; k++]; cnt]; Array[f9, 100]
  • Perl
    use ntheory ":all"; sub a266148 { my $n = shift; vecsum( map { my $k=$; scalar grep { is_prime("9" x $k . $ . "9" x ($n-$k-1)) } 0+($k>0) .. 8 } 0 .. $n-1 ); } # Dana Jacobsen, Jan 01 2016
  • Python
    from sympy import isprime
    def A266148(n):
        return sum(1 for d in range(-9,1) for i in range(n) if isprime(10**n-1+d*10**i)) # Chai Wah Wu, Dec 31 2015
    

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
Showing 1-8 of 8 results.