diff options
| -rw-r--r-- | challenge-119/lubos-kolouch/perl/ch-2.pl | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/challenge-119/lubos-kolouch/perl/ch-2.pl b/challenge-119/lubos-kolouch/perl/ch-2.pl new file mode 100644 index 0000000000..99334d91b5 --- /dev/null +++ b/challenge-119/lubos-kolouch/perl/ch-2.pl @@ -0,0 +1,41 @@ +#!/usr/bin/perl +#=============================================================================== +# +# FILE: ch-2.pl +# +# USAGE: ./ch-2.pl +# +# DESCRIPTION: Perl Weekly Challenge #119 +# Task 2 - Sequence without 1-1 +# +# AUTHOR: Lubos Kolouch +# CREATED: 07/04/2021 04:44:33 PM +#=============================================================================== + +use strict; +use warnings; + +sub get_nth_number { + my $what = shift; + + my $pos = 0; + my $target = 0; + + while ($target < $what) { + $pos++; + + next if $pos =~ /[04-9]|11/; + $target++; + } + + return $pos; + + +} +use Test::More; + +is(get_nth_number(5), 13); +is(get_nth_number(10), 32); +is(get_nth_number(60), 2223); +done_testing; + |
