diff options
| -rw-r--r-- | challenge-007/adam-russell/blog.txt | 1 | ||||
| -rw-r--r-- | challenge-007/adam-russell/perl5/ch-1.pl | 19 | ||||
| -rw-r--r-- | challenge-007/adam-russell/perl5/ch-2.pl | 14 |
3 files changed, 34 insertions, 0 deletions
diff --git a/challenge-007/adam-russell/blog.txt b/challenge-007/adam-russell/blog.txt new file mode 100644 index 0000000000..25c43b2daa --- /dev/null +++ b/challenge-007/adam-russell/blog.txt @@ -0,0 +1 @@ +https://adamcrussell.livejournal.com/2336.html diff --git a/challenge-007/adam-russell/perl5/ch-1.pl b/challenge-007/adam-russell/perl5/ch-1.pl new file mode 100644 index 0000000000..97fe7e2bad --- /dev/null +++ b/challenge-007/adam-russell/perl5/ch-1.pl @@ -0,0 +1,19 @@ +use strict; +use warnings; +## +# Print all the niven numbers from 0 to 50 inclusive, each on their own line. +# A niven number is a non-negative number that is divisible by the sum of its digits. +## +use constant NIVEN_COUNT => 50; +my $i = 1; +my $count = 0; +do{ + my @digits = split(//,$i); + my $digit_sum = unpack("%32C*", pack("C*", @digits)); + if($i % $digit_sum == 0){ + print "$i "; + $count++; + } + $i++; +}while($count < NIVEN_COUNT); +print "\n"; diff --git a/challenge-007/adam-russell/perl5/ch-2.pl b/challenge-007/adam-russell/perl5/ch-2.pl new file mode 100644 index 0000000000..b351bb1dea --- /dev/null +++ b/challenge-007/adam-russell/perl5/ch-2.pl @@ -0,0 +1,14 @@ +use strict; +use warnings; +## +# Given two input words and a file that contains an ordered word list, implement a +# routine (e.g., find_shortest_ladder(word1, word2, wordlist)) that finds the shortest +# ladder between the two input words. +# +# A word ladder is a sequence of words [w_0, w_1, ..., w_n] such that each word w_i in +# the sequence is obtained by changing a single character in the word wi-1. +## +use Graph; +sub find_shortest_ladder{ + +} |
