MillerTestMultiple is like MillerTest but runs the test for multiple witnesses.
(num int64, witnesses ...int64)
| 83 | // MillerTestMultiple is like MillerTest but runs the test for multiple |
| 84 | // witnesses. |
| 85 | func MillerTestMultiple(num int64, witnesses ...int64) (bool, error) { |
| 86 | for _, witness := range witnesses { |
| 87 | prime, err := MillerTest(num, witness) |
| 88 | if err != nil { |
| 89 | return false, err |
| 90 | } |
| 91 | |
| 92 | if !prime { |
| 93 | return false, nil |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | return true, nil |
| 98 | } |
| 99 | |
| 100 | // MillerRabinProbabilistic is a probabilistic test for primality |
| 101 | // of an integer based of the algorithm devised by Miller and Rabin. |
no test coverage detected