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!)
A358690 Number of n-digit primes whose digits are all odd. 2
3, 12, 42, 125, 608, 2427, 10081, 43568, 197823, 873432, 3978580, 18159630, 83753054, 387670103, 1811802273, 8451565541, 39790817677 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
LINKS
FORMULA
a(n) = A358685(n) - A358685(n-1).
EXAMPLE
a(2) = 12 as there are 12 2-digit primes whose digits are all odd: 11, 13, 17, 19, 31, 37, 53, 59, 71, 73, 79, 97.
MATHEMATICA
Length[Select[Prime[Range[PrimePi[10^(n - 1)], PrimePi[10^n]]], And @@ OddQ[IntegerDigits[#]] &]]
PROG
(Python)
from sympy import primerange
def a(n):
num=0
for f in range(1, 10, 2):
p=list(primerange(f*10**(n-1), (f+1)*10**(n-1)))
num+=sum(1 for k in p if all(int(d) %2 for d in str(k)))
return(num)
print ([a(n) for n in range(1, 8)])
(Python)
from sympy import isprime
from itertools import count, islice, product
def a(n):
c = 0 if n > 1 else 1
for p in product("13579", repeat=n-1):
s = "".join(p)
for last in "1379":
if isprime(int(s+last)): c += 1
return c
print([a(n) for n in range(1, 10)]) # Michael S. Branicky, Nov 27 2022
CROSSREFS
Sequence in context: A260153 A328299 A135264 * A084529 A017941 A066972
KEYWORD
base,nonn,more
AUTHOR
Zhining Yang, Nov 26 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 24 2022
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 July 31 12:02 EDT 2024. Contains 374800 sequences. (Running on oeis4.)