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!)
A359813 Number of primes < 10^n with exactly one odd decimal digit. 0
3, 12, 45, 171, 619, 2560, 10774, 46708, 202635, 904603, 4073767, 18604618, 85445767, 395944114, 1837763447, 8600149593 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
a(n) =~ Pi(10^n)/2^(n-1). Robert G. Wilson v, Feb 04 2023
LINKS
EXAMPLE
a(2)=12 as there are 12 primes less than 100 with exactly one odd decimal digit: 3, 5, 7, 23, 29, 41, 43, 47, 61, 67, 83, 89.
MATHEMATICA
c=1; k=0; lst={}; f[n_] := Block[{e = 10 FromDigits[2 IntegerDigits[n, 5]]}, Length@ Select[e + {1, 3, 7, 9}, PrimeQ]];
Do[ While[k< 5^n, c+=f@k; k++]; Print[c], {n, 0, 16}] (* Robert G. Wilson v, Feb 04 2023 *)
PROG
(Python)
from sympy import isprime
from itertools import product
def a(n):
c=3
if n==1:return(c)
x=[[1, 7], [1, 3, 7, 9], [3, 9], '2468', '02468']
for k in range(2, n+1):
for f in x[3]:
for m in product(x[4], repeat=k-2):
s = int(f+"".join(m))*10
t=s%3
for last in x[t]:
if isprime(s+last):
c+= 1
return(c)
print([a(n) for n in range(1, 7)])
(Python)
from sympy import primerange
def a(n):
p=list(primerange(3, 10**n))
return(sum(1 for k in p if sum(str(k).count(d) for d in '13579')==1))
print([a(n) for n in range(1, 7)])
CROSSREFS
Sequence in context: A005320 A062561 A128593 * A085481 A030195 A114515
KEYWORD
base,nonn,more
AUTHOR
Zhining Yang, Jan 14 2023
EXTENSIONS
a(16) from Robert G. Wilson v, Feb 04 2023
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 May 3 13:38 EDT 2024. Contains 372212 sequences. (Running on oeis4.)