login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 


A034093
Number of near-repunit primes that can be formed from (10^k - 1)/9 by changing just one digit from 1 to 0.
7
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,8
REFERENCES
C. K. Caldwell and H. Dubner, The near repunits primes, J. Rec. Math., Vol. 27(1), 1995, pp. 35-41.
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 1..2000
Chris Caldwell, Repunits.
EXAMPLE
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.
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 *)
PROG
(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
CROSSREFS
KEYWORD
nonn,base
AUTHOR
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
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 21 03:03 EDT 2024. Contains 376079 sequences. (Running on oeis4.)