Sum of Divisors for OCaml Golf Competition by chocobi

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

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

download

return to the top page