Sum of Divisors for OCaml Golf Competition by hideaki_t

while 1=1do let n=read_int()in let rec f x=if x>n then 0else if n=n/x*x then x+(f(x+1))else f(x+1)in Printf.printf"%d: %d\x0d
"n(f 1)done

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

download

return to the top page