Sum of Divisors for OCaml Golf Competition by yt

procedure GNAT.Spitbol.Patterns.a is
d:string:=get_line;q,s:integer:=0;begin
q:=integer'value(d);for i in 1..q loop
s:=s+q/i*i/q*i;end
loop;put_line(d&":"&s'img);a;end;

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

download

return to the top page