Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Largest prime factor of 600851475143:
let primeFactors n =
let isFactor n d = n % d = 0L
let nextFactor n d = seq {d..n} |> Seq.find (isFactor n)
(n, 2L, []) |> Seq.unfold (fun (n, d, a) ->
if isFactor n d then Some(d, ((n / d), d, (d :: a)))
elif n > d then Some(d, (n, nextFactor n d, a))
else None)
600851475143L |> primeFactors |> Seq.max