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.

A034093 Number of near-repunit primes that can be formed from (10^k - 1)/9 by changing just one digit from 1 to 0.

Original entry on oeis.org

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

Views

Author

Keywords

Examples

			a(12) = 5 because from (10^12 - 1)/9 = 111111111111, by changing just one digit from 1 to 0, out of the eleven candidates, 111111111101, 111111110111, 111111011111, 111011111111 and 101111111111 are primes.
		

References

  • C. K. Caldwell and H. Dubner, The near repunits primes, J. Rec. Math., Vol. 27(1), 1995, pp. 35-41.

Crossrefs

Programs

  • Mathematica
    a = {}; Do[ p = IntegerDigits[ (10^n - 1)/9 ]; c = 0; Do[ If[ q = FromDigits[ ReplacePart[p, 0, i]]; PrimeQ[q], c++ ], {i, 2, n} ]; a = Append[a, c], {n, 1, 100} ]; a (* Robert G. Wilson v, Nov 19 2001 *)
  • PARI
    a(n)=sum(i=1,n-2,ispseudoprime(10^n\9-10^i)) \\ Charles R Greathouse IV, May 01 2012
    
  • Python
    from sympy import isprime
    def a(n):
        Rn = (10**n-1)//9
        return sum(1 for i in range(n-1) if isprime(Rn-10**i))
    print([a(n) for n in range(1, 101)]) # Michael S. Branicky, Nov 04 2023

Extensions

More terms from Robert G. Wilson v, Nov 19 2001
Edited by N. J. A. Sloane, Oct 02 2008 at the suggestion of R. J. Mathar