RosettaCodeData/Task/Amicable-pairs/Perl/amicable-pairs.pl
2015-02-20 09:02:09 -05:00

5 lines
138 B
Raku

use ntheory qw/divisor_sum/;
for my $x (1..20000) {
my $y = divisor_sum($x)-$x;
say "$x $y" if $y > $x && $x == divisor_sum($y)-$y;
}