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.

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