Implement the program PrimeCounter
which
- takes a minimum and a maximum number as well as a number of threads as command line arguments
- creates a thread pool with the specified number of threads
- splits the given range into subranges and submits tasks each of which counts the prime numbers in one subrange
- displays the total number of found prime numbers and the required runtime
> java PrimeCounter 1 10000000 4
664579 prime numbers found in 4.859 seconds
(The table on the Wikipedia page of the prime-counting function can be used to verify the results.)