(* 2^(15) = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26. What is the sum of the digits of the number 2^(1000)? *) open Big_int;; let b0 = big_int_of_int 0;; let b10 = big_int_of_int 10;; let bn = power_int_positive_int 2 1000;; let rec sumup bn s = if(eq_big_int bn b0) then s else sumup (div_big_int bn b10) ( (int_of_big_int (mod_big_int bn b10))+s ) ;; Printf.printf "%s\n" (string_of_big_int bn);; Printf.printf "%d\n" (sumup bn 0);;