Sha256: f4c255154f6681e78f8eac3ebb1189bd4e73af6929298a478964a25b37f01870
Contents?: true
Size: 326 Bytes
Versions: 34
Compression:
Stored size: 326 Bytes
Contents
object Prime { // The stream will cache calculated primes. This is nice for performance, // but not so nice for memory utilization. private lazy val primes: Stream[BigInt] = Stream.cons(BigInt(2), primes.map(b => new BigInt(b.bigInteger.nextProbablePrime))) def nth(n: Int): Int = primes.drop(n - 1).head.toInt }
Version data entries
34 entries across 34 versions & 1 rubygems