A358685 Number of primes < 10^n whose digits are all odd.
3, 15, 57, 182, 790, 3217, 13298, 56866, 254689, 1128121, 5106701, 23266331, 107019385, 494689488, 2306491761, 10758057302, 50548874979
Offset: 1
Examples
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.
Links
- BBS Math Blog, How many prime numbers are all composed of 1,3,5,7,9? (in Chinese).
Programs
-
Mathematica
n=7 Length[Select[Prime[Range[PrimePi[10^n]]], And @@ OddQ[IntegerDigits[#]] &]] (* Zhining Yang, Nov 26 2022 *) n = PrimePi[10^8]; Sum[If[MemberQ[IntegerDigits[Prime[i]], _?EvenQ], 0, 1], {i, 1, n}] (* Jianlin Su, Nov 27 2022 *)
-
Python
from sympy import primerange def a(n): p=list(primerange(3,10**n)) return(sum(1 for k in p if all(int(d) %2 for d in str(k))==True)) print ([a(n) for n in range(1,8)])
-
Python
from sympy import isprime from itertools import count, islice, product def agen(): # generator of terms c = 3 for d in count(2): yield c for p in product("13579", repeat=d-1): s = "".join(p) for last in "1379": if isprime(int(s+last)): c += 1 print(list(islice(agen(), 9))) # Michael S. Branicky, Nov 27 2022
Extensions
a(10)-a(14) from Michael S. Branicky, Nov 26 2022
a(15) from Zhining Yang, Dec 21 2022
a(16)-a(17) from Martin Ehrenstein, Dec 21 2022