Files
lci/lib/utility.ml

7 lines
128 B
OCaml
Raw Normal View History

let rec pow a = function
| 0 -> 1
| 1 -> a
| n ->
let b = pow a (n / 2) in
b * b * (if n mod 2 = 0 then 1 else a)