let euler16 n =
  let p = ref 1 in
  for _ = 1 to n do p := !p * 2 done;
  let sum = ref 0 in
  let m = ref !p in
  while !m > 0 do
    sum := !sum + !m mod 10;
    m := !m / 10
  done;
  !sum

;;

euler16 15
