How many prime numbers in a given interval?
Use the prime-counting function and get $\pi(a_n)-\pi(a_1-1)$
The prime number theorem gives an approximation to $\pi(n),$ the number of primes less than $n$. You can subtract the values at the start and end of an interval. Mathematica and other software can compute exact values for small values of $n$ and approximate values for larger values of $n$. The first approximation is $\pi(n) \sim \frac n{\log n}$ but a much better one is $$\pi(n)\sim \int_2^n \frac {dt}{\log t}$$