aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrbaggy <js5@sanger.ac.uk>2021-10-15 12:30:10 +0100
committerdrbaggy <js5@sanger.ac.uk>2021-10-15 12:30:10 +0100
commit17f80bf213692c67f843cffe008e9e95401c4b8e (patch)
treedda28d54bb15d355df4bd4aadebcbbf7629706b8
parent0a1aa8935d04b75b74f895ba747b20c47283f2c9 (diff)
downloadperlweeklychallenge-club-17f80bf213692c67f843cffe008e9e95401c4b8e.tar.gz
perlweeklychallenge-club-17f80bf213692c67f843cffe008e9e95401c4b8e.tar.bz2
perlweeklychallenge-club-17f80bf213692c67f843cffe008e9e95401c4b8e.zip
tweaked assignment
-rw-r--r--challenge-134/james-smith/README.md2
-rw-r--r--challenge-134/james-smith/perl/ch-1.pl10
2 files changed, 6 insertions, 6 deletions
diff --git a/challenge-134/james-smith/README.md b/challenge-134/james-smith/README.md
index 4b25bd49ff..1d17e5726f 100644
--- a/challenge-134/james-smith/README.md
+++ b/challenge-134/james-smith/README.md
@@ -31,7 +31,7 @@ To walk the pandigital numbers we can write a script which generates the next pe
We note though that we don't have to start at 0123456789 (the lowest permutation) as all numbers starting with 0 are skipped. We can then pre-empty this loop by noting the largest permutation 0987654321 which isn't a pan-digital number, so when we find the next iteration we have our first pandigital number....
```perl
-my @s = (0,reverse 1..9);
+my @s = reverse 1..9, 0;
sub next_perm {
my( $i, $j );
diff --git a/challenge-134/james-smith/perl/ch-1.pl b/challenge-134/james-smith/perl/ch-1.pl
index fd268b70a0..d8d09d9c4f 100644
--- a/challenge-134/james-smith/perl/ch-1.pl
+++ b/challenge-134/james-smith/perl/ch-1.pl
@@ -8,11 +8,11 @@ use Test::More;
use Benchmark qw(cmpthese timethis);
use Data::Dumper qw(Dumper);
-my @s = (0,reverse 1..9); ## Cheat we start with the last perumation
- ## starting with 0 - 0987654321
- ## Saves us looping through the first
- ## combinations checking for number starting
- ## with non-zero (362880 combinations)
+my @s = reverse 1..9,0; ## Cheat we start with the last perumation
+ ## starting with 0 - 0987654321
+ ## Saves us looping through the first
+ ## combinations checking for number starting
+ ## with non-zero (362880 combinations)
my $count = @ARGV ? $ARGV[0] : 5;
sub next_perm {