Scanf.scanf "%d" (fun n -> let sum d = let rec loop i acc = if i = 0 then acc else loop (i / 10) (acc + i mod 10) in loop d 0 in let rec loop i d = if i = 0 then d else loop (i - 1) (sum d) in loop 100 n |> Printf.printf "%d\n" )