diff options
| -rw-r--r-- | challenge-003/sergiotarxz/perl5/ch-1.pl | 9 | ||||
| -rw-r--r-- | challenge-003/sergiotarxz/perl5/ch-2.pl | 10 |
2 files changed, 19 insertions, 0 deletions
diff --git a/challenge-003/sergiotarxz/perl5/ch-1.pl b/challenge-003/sergiotarxz/perl5/ch-1.pl new file mode 100644 index 0000000000..d4dedb814f --- /dev/null +++ b/challenge-003/sergiotarxz/perl5/ch-1.pl @@ -0,0 +1,9 @@ +use v5.28; +my @a = (2,3,5); +for (my $i=1; $i<$ARGV[0]; $i++) { + my $a = $i; + for (@a) { + $a/=$_ until $a%$_; + } + $a==1 and say $i; +} diff --git a/challenge-003/sergiotarxz/perl5/ch-2.pl b/challenge-003/sergiotarxz/perl5/ch-2.pl new file mode 100644 index 0000000000..e08c0b10d5 --- /dev/null +++ b/challenge-003/sergiotarxz/perl5/ch-2.pl @@ -0,0 +1,10 @@ +$ARGV[0] > 2 or die "This program requires at least 3 rows to work"; +for (my $i = 1; $i<=$ARGV[0]; $i++) { + my $c = 1; + print " "x($ARGV[0]-$i); + for (my $e = 1; $e<=$i; $e++) { + print "$c "; + $c = int($c*($i-$e)/$e); + } + print "\n"; +} |
