Proper divisors: Difference between revisions

Fixed D entry according to the Python entry
(Fixed D entry according to the Python entry)
Line 15:
 
=={{header|D}}==
{{incorrect|D|1 has no proper divisors.}}
{{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>[[1], [1], [1], [1, 2], [1], [1, 2, 3], [1], [1, 2, 4], [1, 3], [1, 2, 5]]
Tuple!(uint, int)(79, 18480)</pre>
The Run-time is about 0.7167 seconds with the ldc2 compiler.
 
=={{header|J}}==