Arithmetic/Rational: Difference between revisions
Content added Content deleted
m (added ;Task: and ;Related task: (bold) headers.) |
SqrtNegInf (talk | contribs) m (→{{header|Perl 6}}: use .nude) |
||
Line 2,530: | Line 2,530: | ||
=={{header|Perl 6}}== |
=={{header|Perl 6}}== |
||
{{ |
{{Works with|rakudo|2016.08}} |
||
Perl 6 supports rational arithmetic natively. |
Perl 6 supports rational arithmetic natively. |
||
<lang perl6>for 2..2**19 -> $candidate { |
<lang perl6>for 2..2**19 -> $candidate { |
||
Line 2,539: | Line 2,539: | ||
} |
} |
||
} |
} |
||
if $sum. |
if $sum.nude[1] == 1 { |
||
say "Sum of reciprocal factors of $candidate = $sum exactly", ($sum == 1 ?? ", perfect!" !! "."); |
say "Sum of reciprocal factors of $candidate = $sum exactly", ($sum == 1 ?? ", perfect!" !! "."); |
||
} |
} |