(* The sum of the squares of the first ten natural numbers is, 1^(2) + 2^(2) + ... + 10^(2) = 385 The square of the sum of the first ten natural numbers is, (1 + 2 + ... + 10)^(2) = 55^(2) = 3025 Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025 ? 385 = 2640. Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum. *) let dsq l = let rec dsq l = match l with [] -> 0 | h::t -> ( List.fold_left (+) 0 ( List.map ( fun x->(h*x) ) t ) )+ ( dsq t ) in 2*(dsq l) ;; (* list nat numbers below n *) let nb n = let rec pdb n l = if (n<1) then l else pdb (n-1) (n::l) in pdb n [] ;; Printf.printf "%d\n" (dsq (nb 100));;