Sha256: c576e1d51700e8142c2d0f0ca6951963944f57ceb54843305d4a38df70160b2a
Contents?: true
Size: 369 Bytes
Versions: 198
Compression:
Stored size: 369 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): Option[Int] = if (n < 1) None else Some(primes.drop(n - 1).head.toInt) }
Version data entries
198 entries across 198 versions & 1 rubygems