Sha256: 7fda8ffd599ba40895850786e9533c298baa0884cef2bbf06d159747dcc5ddb9
Contents?: true
Size: 336 Bytes
Versions: 116
Compression:
Stored size: 336 Bytes
Contents
import java.math.BigInteger object Prime { fun nth(n: Int): Int { require(n > 0) { "There is no zeroth prime." } return primes().drop(n - 1).first().toInt() } private fun primes(): Sequence<BigInteger> = generateSequence(BigInteger.valueOf(2)) { previous -> previous.nextProbablePrime() } }
Version data entries
116 entries across 116 versions & 1 rubygems