Project Euler 3 - Largest Prime Factor - Solved with Reason

The third Project Euler problem - Largest Prime Factor - is stated as follows. What is the largest prime factor of the number 600851475143?

let getPrimeFactors = (num) => {
  let rec next = (num, i, res) =>
    switch (num > 1, num mod i === 0) {
    | (true, true) => next(num / i, 2, [i, ...res])
    | (true, false) => next(num, i + 1, res)
    | _ => res
    };
  next(num, 2, [])
};

getPrimeFactors(600851475143)
    |> List.sort(compare)
    |> List.rev
    |> List.hd
    |> print_int;