Standard library / math/big
big.Int.ProbablyPrime()
Test probable primality using the configured number of Miller-Rabin rounds and a Baillie-PSW test. Not suitable for adversarially crafted candidates. Expected stdout: 'true false\n'.
Formal Syntax & Structure
go syntaxgo
func (x *Int) ProbablyPrime(n int) boolParameters & Attributes
| Name | Type | Description |
|---|---|---|
| n | int | Nonnegative number of Miller-Rabin rounds. |
Return Value
bool
Returns the result described above; see the example for the observed behavior.
Working Example
Example Snippetgo
package main
import ( "fmt" "math/big")
func main() { fmt.Println(big.NewInt(97).ProbablyPrime(8), big.NewInt(99).ProbablyPrime(8))}