Jump to content

Factors of an integer: Difference between revisions

m (→‎optimized version: added text to a comment in the REXX section header. -- ~~~~)
Line 1,696:
 
=={{header|Perl 6}}==
{{works with|Rakudo Star|20102013-0810}}
<lang perl6>sub factors (Int $n) {
sort +*,uniq keys hash
map { $^x => 1, $n div $^x => 1 },
grep { $n %% $^x },
1 .. ceiling sqrt $n;
}</lang>
 
1,934

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.