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.