diff options
| author | drbaggy <js5@sanger.ac.uk> | 2022-07-04 21:10:19 +0100 |
|---|---|---|
| committer | drbaggy <js5@sanger.ac.uk> | 2022-07-04 21:10:19 +0100 |
| commit | 251b2bd8b0ff8d3b1262173c33a4e999cf37846a (patch) | |
| tree | e6d58a6a75f6a895cb07762b0183860f48096b9d /challenge-146 | |
| parent | 9a0e9aa937cd71b048889a57f68896e5187466ac (diff) | |
| download | perlweeklychallenge-club-251b2bd8b0ff8d3b1262173c33a4e999cf37846a.tar.gz perlweeklychallenge-club-251b2bd8b0ff8d3b1262173c33a4e999cf37846a.tar.bz2 perlweeklychallenge-club-251b2bd8b0ff8d3b1262173c33a4e999cf37846a.zip | |
new stuff
Diffstat (limited to 'challenge-146')
| -rw-r--r-- | challenge-146/james-smith/perl/ch-2.pl | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/challenge-146/james-smith/perl/ch-2.pl b/challenge-146/james-smith/perl/ch-2.pl index 9c30a15515..91ff162d61 100644 --- a/challenge-146/james-smith/perl/ch-2.pl +++ b/challenge-146/james-smith/perl/ch-2.pl @@ -11,7 +11,7 @@ my @TESTS = ( [ 3, 5, '3/5 3/2 1/2 1/1' ], [ 4, 3, '4/3 1/3 1/2 1/1' ], [ 101, 45, '101/45 56/45 11/45 11/34 11/23 11/12 11/1 10/1 9/1 8/1 7/1 6/1 5/1 4/1 3/1 2/1 1/1' ], - [ 6, 4, '6/4 2/4 2/2 0/2' ], ## Not part of tree - but need to see what it does! + [ 6, 4, '6/4 2/4 2/2' ], ## Not part of tree - but need to see what it does! ); is( stringify( tree($_->[0],$_->[1]) ), $_->[2] ) foreach @TESTS; @@ -20,7 +20,7 @@ done_testing(); sub tree { my @tr=[my($n,$d)=@_]; - push@tr,$d>$n?[$n,$d-=$n]:[$n-=$d,$d]while$n*$d>1; + push@tr,$d>$n?[$n,$d-=$n]:[$n-=$d,$d]while$n-$d; \@tr; } |
