Euclid-Mullin sequence: Difference between revisions
→{{header|Go}}: Aligned with changes to Wren version of which it's a translation. No change in runtime.
m (→{{header|Wren}}: Removed stray '>') |
(→{{header|Go}}: Aligned with changes to Wren version of which it's a translation. No change in runtime.) |
||
Line 212:
six = big.NewInt(6)
ten = big.NewInt(10)
)
Line 248:
}
func smallestPrimeFactorWheel(n, max *big.Int) *big.Int {
if n.ProbablyPrime(15) {
return n
Line 279:
func smallestPrimeFactor(n *big.Int) *big.Int {
s := smallestPrimeFactorWheel(n, k100)
if s != nil {
return s
Line 285:
c := big.NewInt(1)
s = new(big.Int).Set(n)
for
d := pollardRho(n, c)
if d.Cmp(zero) == 0 {
Line 293:
c.Add(c, one)
} else {
//
// check whether
s = smallestPrimeFactorWheel(n.Quo(n, d), factor)
}▼
if
} else
return factor
}
} else
}
}
}
}
|