Anonymous user
Proper divisors: Difference between revisions
Fixed D entry according to the Python entry
(→{{header|Python}}: Fix for 1.) |
(Fixed D entry according to the Python entry) |
||
Line 15:
=={{header|D}}==
{{trans|Python}}
Currently the lambda of the filter allocates a closure on the GC-managed heap.
Line 22 ⟶ 21:
immutable properDivs = (in uint n) pure nothrow @safe /*@nogc*/ =>
iota(1, (n + 1) / 2 + 1).filter!(x => n % x == 0 && n != x);
iota(1, 11).map!properDivs.writeln;
Line 28 ⟶ 27:
}</lang>
{{out}}
<pre>[[
Tuple!(uint, int)(79, 18480)</pre>
The Run-time is about 0.
=={{header|J}}==
|