Prime Range Queries

So given a problem that goes something like how many primes are in the range [a, b] where 1 <= a, b <= 1e9, or some other large number (where you simply cannot store it in a array of such size), how would you solve that?

Could you provide the source of this problem to make sure you’re not asking this during a live contest to cheat?