fix getNumofPrimes - use break but not continue