Chernick's Carmichael numbers: Difference between revisions

→‎{{header|Go}}: Changed argument to ProbablyPrime function to 0. Almost halves run time (now 3.5s).
(added Carmichael 3 strong pseudoprimes as related task)
(→‎{{header|Go}}: Changed argument to ProbablyPrime function to 0. Almost halves run time (now 3.5s).)
Line 87:
func ccFactors(n, m uint64) (*big.Int, bool) {
prod.SetUint64(6*m + 1)
if !prod.ProbablyPrime(100) {
return zero, false
}
fact.SetUint64(12*m + 1)
if !fact.ProbablyPrime(100) { // 100% accurate up to 2 ^ 64
return zero, false
}
Line 97:
for i := uint64(1); i <= n-2; i++ {
fact.SetUint64((1<<i)*9*m + 1)
if !fact.ProbablyPrime(100) {
return zero, false
}
9,476

edits