diff options
| author | drbaggy <js5@sanger.ac.uk> | 2020-11-30 13:24:16 +0000 |
|---|---|---|
| committer | drbaggy <js5@sanger.ac.uk> | 2020-11-30 13:24:16 +0000 |
| commit | 5e711b47582551b3001954feddf4165d25addff9 (patch) | |
| tree | 1ece2a5c02de7fef2c96f52450f95f3e945a130b | |
| parent | d68c4c4f346bd57aebb20a65542e4aa7d4caa4f2 (diff) | |
| download | perlweeklychallenge-club-5e711b47582551b3001954feddf4165d25addff9.tar.gz perlweeklychallenge-club-5e711b47582551b3001954feddf4165d25addff9.tar.bz2 perlweeklychallenge-club-5e711b47582551b3001954feddf4165d25addff9.zip | |
add note to explain how we know e is 5...
| -rw-r--r-- | challenge-089/james-smith/perl/ch-2.pl | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/challenge-089/james-smith/perl/ch-2.pl b/challenge-089/james-smith/perl/ch-2.pl index 0800bb4105..25befeef39 100644 --- a/challenge-089/james-smith/perl/ch-2.pl +++ b/challenge-089/james-smith/perl/ch-2.pl @@ -9,6 +9,11 @@ say map { "@{$_}\n" } @{$_} foreach magic(); ## We now $e must be 5... so we only need to loop through values 1..9 ## for both a and b with possible values such that $c < 10 ## the inner loop is then executed just 32 times.... + +## We can generate all values if we only have a b & e +## If we do this we get the sums of the 2nd and 3rd row as 3e & 30-3e respectively +## For these to both be 15 e must be 5. + sub magic { my @solutions = (); foreach my $a (1..4,6..9) { ## a can't be 5... |
