Sum of Divisors for OCaml Golf Competition by par

while true do
let n=read_int()in
let rec f i s=
if i>n then Printf.printf"%d: %d\n"n s
else f(i+1)(if n mod i=0 then s+i else s)in
f 1 0
done

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page