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

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A209252 Number of primes (excluding n) that may be generated by replacing any decimal digit of n with a digit from 0 to 9. 5
4, 4, 3, 3, 4, 3, 4, 3, 4, 4, 4, 7, 5, 9, 4, 5, 4, 8, 4, 7, 2, 7, 3, 7, 2, 3, 2, 8, 2, 5, 2, 5, 3, 9, 2, 3, 2, 6, 2, 7, 3, 6, 4, 8, 3, 4, 3, 7, 3, 8, 2, 7, 3, 7, 2, 3, 2, 8, 2, 5, 2, 5, 3, 9, 2, 3, 2, 6, 2, 7, 3, 6, 4, 8, 3, 4, 3, 9, 3, 6, 2, 7, 3, 7, 2, 3, 2, 8, 2, 5, 1, 6, 2, 8, 1, 2, 1, 5, 1, 6, 4, 10, 5, 9, 4 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,1
COMMENTS
I expect that the average value of a(n) is 45/log 100 if n is coprime to 10 and 0 otherwise. - Charles R Greathouse IV, Jan 14 2013
First occurrence of k = 0..27: 200, 90, 20, 2, 1, 12, 37, 11, 17, 13, 101, 109, 107, 177, 357, 1001, 1011, 10759, 13299, 11487, 42189, 113183, 984417, 344253, 1851759, 4787769, 16121457, 15848679. - Robert G. Wilson v, Dec 19 2015
LINKS
Terence Tao, A remark on primality testing and decimal expansions, Journal of the Australian Mathematical Society 91:3 (2011), pp. 405-413.
EXAMPLE
a(0) = 4 because by replacing the digit 0, we obtain the 4 primes 2, 3, 5 and 7;
a(11) = 7 because by replacing the 1st digit of *1, we obtain the primes 31, 41, 61, 71, and by replacing the 2nd digit of 1* we obtain the primes 13, 17, 19, hence a(11) = 7.
a(13) = 8 because 03, 11, 17, 19, 23, 43, 53, 73 and 83 are all primes.
a(204) = 0 because it is impossible to find a prime number if we replace the digits 2, 0 or 4.
MAPLE
A209252 := proc(n)
local a, dgs, d, r, pd, p ;
a := 0 ;
dgs := convert(n, base, 10) ;
for d from 1 to nops(dgs) do
for r from 0 to 9 do
pd := subsop(d=r, dgs) ;
p := add(op(i, pd)*10^(i-1), i=1..nops(pd)) ;
if isprime(p) and p <> n then
a := a+1 ;
end if;
end do:
end do:
a ;
end proc: # R. J. Mathar, Jan 18 2013
MATHEMATICA
f[n_] := Block[{c = k = 0, d, p, lmt = 1 + Floor@ Log10@ n}, While[k < lmt, d = 0; While[d < 10, p = Quotient[n, 10^(k+1)]*10^(k+1) + d*10^k + Mod[n, 10^k]; If[p != n && PrimeQ@ p, c++]; d++]; k++]; c]; f[0] = 4; Array[f, 105, 0] (* Robert G. Wilson v, Dec 19 2015 *)
PROG
(Python)
from sympy import isprime
def A209252(n):
return len([1 for i in range(len(str(n))) for d in '0123456789' if d != str(n)[i] and isprime(int(str(n)[:i]+d+str(n)[i+1:]))]) # Chai Wah Wu, Sep 19 2016
CROSSREFS
Cf. A000040.
Sequence in context: A329205 A023402 A073261 * A265131 A344894 A305403
KEYWORD
nonn,base
AUTHOR
Michel Lagneau, Jan 14 2013
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | 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 13 13:43 EDT 2024. Contains 375908 sequences. (Running on oeis4.)