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
There is a fast, simple approximation to the number of primes below a given bound. If you do not need exact values, then a difference of two evaluations of this formula will get you close.