My problem reduces to finding the number of primes between two given numbers.I could have a range as big as 1 to (1000)!
and hence I am need of some mathematical op
Since you want to go as high as 1000!
(factorial). You will not be able to get exact results with currently known methods on current technology.
The Prime Counting Function has only been evaluated exactly for a handful of values up to 10^24
. So no way you'll be able to hit 1000!
.
But since you mention than an approximation may be fine, you can use the Logarithmic Integral as an approximation to the Prime Counting Function.
This is based on the Prime Number Theorem which says that the Prime Counting Function is asymptotic to the Logarithmic Integral.