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!)
A358685 Number of primes < 10^n whose digits are all odd. 2

%I #43 Dec 22 2022 02:12:58

%S 3,15,57,182,790,3217,13298,56866,254689,1128121,5106701,23266331,

%T 107019385,494689488,2306491761,10758057302,50548874979

%N Number of primes < 10^n whose digits are all odd.

%H BBS Math Blog, <a href="https://bbs.emath.ac.cn/thread-18361-1-1.html">How many prime numbers are all composed of 1,3,5,7,9?</a> (in Chinese).

%e a(2) = 15 as there are 15 primes less than 100 whose digits are all odd: 3, 5, 7, 11, 13, 17, 19, 31, 37, 53, 59, 71, 73, 79, 97.

%t n=7

%t Length[Select[Prime[Range[PrimePi[10^n]]], And @@ OddQ[IntegerDigits[#]] &]] (* _Zhining Yang_, Nov 26 2022 *)

%t n = PrimePi[10^8];

%t Sum[If[MemberQ[IntegerDigits[Prime[i]], _?EvenQ], 0, 1], {i, 1, n}]

%t (* _Jianlin Su_, Nov 27 2022 *)

%o (Python)

%o from sympy import primerange

%o def a(n):

%o p=list(primerange(3,10**n))

%o return(sum(1 for k in p if all(int(d) %2 for d in str(k))==True))

%o print ([a(n) for n in range(1,8)])

%o (Python)

%o from sympy import isprime

%o from itertools import count, islice, product

%o def agen(): # generator of terms

%o c = 3

%o for d in count(2):

%o yield c

%o for p in product("13579", repeat=d-1):

%o s = "".join(p)

%o for last in "1379":

%o if isprime(int(s+last)): c += 1

%o print(list(islice(agen(), 9))) # _Michael S. Branicky_, Nov 27 2022

%Y Cf. A030096, A358690.

%K base,nonn,more

%O 1,1

%A _Zhining Yang_, Nov 26 2022

%E a(10)-a(14) from _Michael S. Branicky_, Nov 26 2022

%E a(15) from _Zhining Yang_, Dec 21 2022

%E a(16)-a(17) from _Martin Ehrenstein_, Dec 21 2022

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 June 23 17:30 EDT 2024. Contains 373653 sequences. (Running on oeis4.)