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
The fastest method that I know would be to eliminate all of the known non-primes (even numbers, all the numbers with divisers lower than the start number in the range, etc) as fast as you can, then iterate over the rest and use something like the Euclidean algorithm to determine if that number is a prime.