10533 - Digit Primes

Difficulty : medium

Solution Description :

Math Prime number problem

At first pre-generate prime number up to 10^6
and pre-generate count digit prime.
for i=1 to 10^6
-----digitPrime[i] = digitPrime[i-1]
-----if i is prime and sum of digit of i is also prime then digitPrime[i]++

for each input t1 and t2
print digitPrime[t2]-digitPrime[t1-1]