In this problem prime numbers are defined as Dumb numbers. You only need to find the number of prime numbers in a range.
As the range is only upto 10^5. We can simply pregenerate the prime numbers and store a cumulative sum of prime numbers count in an array from 1 to 10^5.
Let's say the array is sum. So the output will be sum[b]-sum[a-1].

We can use prime sieve to generate prime numbers for faster solution.
But this problem can be solved without prime sieve.

Statistics

64% Solution Ratio
hamza05Earliest, Apr '18
steinumFastest, 0.0s
steinumLightest, 5.5 kB
Tanveer2202Shortest, 519B
Toph uses cookies. By continuing you agree to our Cookie Policy.