let factorial n =
  if n < 2 then 1 else
    let rec aux acc n = if n < 2 then acc else aux (n * acc) (n - 1) in
    aux 1 n