|
|
A358685
|
|
Number of primes < 10^n whose digits are all odd.
|
|
2
|
|
|
3, 15, 57, 182, 790, 3217, 13298, 56866, 254689, 1128121, 5106701, 23266331, 107019385, 494689488, 2306491761, 10758057302, 50548874979
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
LINKS
|
|
|
EXAMPLE
|
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.
|
|
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}]
|
|
PROG
|
(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
|
|
CROSSREFS
|
|
|
KEYWORD
|
base,nonn,more
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|