RosettaCodeData/Task/Amicable-pairs/Perl/amicable-pairs.pl
2023-07-01 13:44:08 -04: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;
}