
primeDigits
You are given a positive integer N
, your task is to calculate the total number of primes less than or equal to N
with additional requirement that each digit of those primes should be a prime number itself.
Example
- For
N = 11
, the output should beprimeDigits(11) = 4
.
There are5
primes less thanN
or equal to it:2
,3
,5
,7
and11
. But there is a digit1
(even two of them) in11
, and1
is not a prime number. Thus, the answer is4
.
Input/Output
-
[execution time limit] 0.5 seconds
-
[input] integer N
Constraints:
0 ≤ N ≤ 106
-
[output] integer
Post Comment