Skip to content
This repository
branch: rename_fun
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

executable file 23 lines (16 sloc) 0.495 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
#!/Users/jeff/Code/rakudo/perl6


# Problem 4
# 16 November 2001
#
# A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 99.
#
# Find the largest palindrome made from the product of two 3-digit numbers.


my $max = 0;
for (100..999) -> $x {
    for ($x..999) -> $y {
        my $product = $x * $y;

        $max = $product if $product > $max
                       and $product eq $product.flip;
    }
}

say "$max";
Something went wrong with that request. Please try again.