An example of how to implement a generic primes generator that you can use with any numerical type. Of course, performances will be impacted by your choice :

  • howlongfor(intPrimes.drop(25000).head) // res0: (String, Int) = (459ms,287137)
  • howlongfor(longPrimes.drop(25000).head) // res1: (String, Long) = (1349ms,287137)
  • howlongfor(bigIntPrimes.drop(25000).head) // res2: (String, BigInt) = (4361ms,287137)

My primes project can be found here.

Simplified source code