This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//MillerRabin.scala | |
import scala.language.implicitConversions | |
object MillerRabin { | |
implicit class MillerRabin(n: Long) { | |
private lazy val asl : Array[BigInt] = if (n < 2047L) Array(2L) | |
else if (n < 1373653L) Array(2L, 3L) | |
else if (n < 9080191L) Array(31L, 73L) | |
else if (n < 25326001L) Array(2L, 3L, 5L) | |
else if (n < 3215031751L) Array(2L, 3L, 5L, 7L) |
NewerOlder