let rec g a b = if b = 0 then a else g b (a mod b)
let f n = let rec f a c d m = if d > m || d * d > n then if c > 0 then (d, c) :: a else if m > 1 then (m, 1) :: a else a else if m mod d = 0 then f a (c + 1) d @@ m / d else f (if c > 0 then (d, c) :: a else a) 0 (d + 1) m in f [] 0 2 n
let _ = Scanf.scanf "%d %d" @@ fun a b -> List.(map (fun (p, _) -> p) @@ f (g a b) |> sort_uniq (-) |> length) |> succ |> Printf.printf "%d\n"