diff options
-rwxr-xr-x | 032.pl | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -0,0 +1,19 @@ +#!/usr/bin/perl +use strict; +use warnings; +use 5.010; +use List::Util qw/sum/; + +my %found; + +A: for my $a (1..99) { + B: for my $b ($a..9999) { + my $prod = $a * $b; + my $length = length($prod) + length($a) + length($b); + next B if $length < 9; + next A if $length > 9; + $found{$prod} = 1 + if join('', sort split //, "$a$b$prod") eq '123456789'; + } +} +say sum keys %found; |