Guest User

project-euler-problem-4.pl

a guest
Dec 10th, 2023
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.27 KB | Source Code | 0 0
  1. use List::Util qw(max);
  2.  
  3. my @palindromes;
  4.  
  5. for my $i (100 .. 999) {
  6.     for my $j (100 .. 999) {
  7.         my $product = $i * $j;
  8.         if (reverse($product) eq $product) {
  9.             push @palindromes, $product;
  10.         }
  11.     }
  12. }
  13.  
  14. print max(@palindromes), "\n";
  15.  
Advertisement
Add Comment
Please, Sign In to add comment