diff options
| author | drbaggy <js5@sanger.ac.uk> | 2021-03-08 22:31:33 +0000 |
|---|---|---|
| committer | drbaggy <js5@sanger.ac.uk> | 2021-03-08 22:31:33 +0000 |
| commit | a827fbf106f43dec6390f447474411685bd75dc6 (patch) | |
| tree | 23bfd09fcc6db5c83f3a1d9bf218fd442bb9b9fb /challenge-102 | |
| parent | 9cebe1eee1e7e69546eaf0c7e4d5361ef9dcaa31 (diff) | |
| download | perlweeklychallenge-club-a827fbf106f43dec6390f447474411685bd75dc6.tar.gz perlweeklychallenge-club-a827fbf106f43dec6390f447474411685bd75dc6.tar.bz2 perlweeklychallenge-club-a827fbf106f43dec6390f447474411685bd75dc6.zip | |
slightly neater
Diffstat (limited to 'challenge-102')
| -rw-r--r-- | challenge-102/james-smith/perl/ch-1.pl | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/challenge-102/james-smith/perl/ch-1.pl b/challenge-102/james-smith/perl/ch-1.pl index 187ed6b95b..dcfb31af4d 100644 --- a/challenge-102/james-smith/perl/ch-1.pl +++ b/challenge-102/james-smith/perl/ch-1.pl @@ -41,10 +41,10 @@ sub rare_numbers { my $x = shift; return () if $F[$x%9]; ## Digit sum is wrong... my $y = reverse $x; - return () if $x == $y; ## Musn't be the same back and forth - return $y if $x<$y && is_sq($x+$y) && is_sq($y-$x); + return () if $x == $y || ! is_sq($x+$y); ## Musn't be the same back and forth + return $y if $x<$y && is_sq($y-$x); + return $x if $y<$x && is_sq($x-$y); ## Check both ways round! - return $x if $y<$x && is_sq($x+$y) && is_sq($x-$y); return (); } |
