Arithmetic/Rational: Difference between revisions

Content added Content deleted
m (added ;Task: and ;Related task: (bold) headers.)
Line 2,530: Line 2,530:


=={{header|Perl 6}}==
=={{header|Perl 6}}==
{{works with|Rakudo|2015.12}}
{{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.denominator == 1 {
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!" !! ".");
}
}