Square-free integers: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) (→{{header|Perl 6}}: Add a Perl 6 example) |
Thundergnat (talk | contribs) m (→{{header|Perl 6}}: More efficient counting sub. If we're only counting, don't need them in order) |
||
Line 202: | Line 202: | ||
for 1e2, 1e3, 1e4, 1e5, 1e6 { |
for 1e2, 1e3, 1e4, 1e5, 1e6 { |
||
say "\nThe number of square─free numbers between 1 and {$_} (inclusive) is: ", |
say "\nThe number of square─free numbers between 1 and {$_} (inclusive) is: ", |
||
+(1 .. .Int). |
+(1 .. .Int).race.map: { 1 if .&is-square-free }; |
||
}</lang> |
}</lang> |
||
{{out}} |
{{out}} |