diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2022-06-16 19:04:09 +0100 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2022-06-16 19:04:09 +0100 |
| commit | 7c08fa9dc330262195c30cd158c14ebdfb59c174 (patch) | |
| tree | 7c68038d48364f7ef2caea6101b391bf0402daad /challenge-169 | |
| parent | 07094b2c5ff58b46ab54497c2a80c5451705fac1 (diff) | |
| download | perlweeklychallenge-club-7c08fa9dc330262195c30cd158c14ebdfb59c174.tar.gz perlweeklychallenge-club-7c08fa9dc330262195c30cd158c14ebdfb59c174.tar.bz2 perlweeklychallenge-club-7c08fa9dc330262195c30cd158c14ebdfb59c174.zip | |
- Added solution by Dario Mazzeo.
Diffstat (limited to 'challenge-169')
| -rw-r--r-- | challenge-169/dario-mazzeo/README | 1 | ||||
| -rwxr-xr-x | challenge-169/dario-mazzeo/perl/ch-1.pl | 24 |
2 files changed, 25 insertions, 0 deletions
diff --git a/challenge-169/dario-mazzeo/README b/challenge-169/dario-mazzeo/README new file mode 100644 index 0000000000..9ed3e21a7f --- /dev/null +++ b/challenge-169/dario-mazzeo/README @@ -0,0 +1 @@ +Solutions by Dario Mazzeo. diff --git a/challenge-169/dario-mazzeo/perl/ch-1.pl b/challenge-169/dario-mazzeo/perl/ch-1.pl new file mode 100755 index 0000000000..08fbc5a5b7 --- /dev/null +++ b/challenge-169/dario-mazzeo/perl/ch-1.pl @@ -0,0 +1,24 @@ +# Autore: Dario Mazzeo (dmazzeo@ingele.com)
+# THE WEEKLY CHALLENGE - 169
+# Task 1: Brilliant Numbers
+
+my @primi=(2,3,5,7,11,13,17,19,23);
+my %ris=();
+my $out="";
+
+foreach my $i (@primi){
+ foreach my $j (@primi){
+ if ($ris{$i*$j}==0 && length($i) eq length($j)){
+ $ris{$i*$j}=1;
+ }
+ }
+}
+
+my $c=0;
+foreach my $i (sort {$a <=> $b} keys %ris){
+ if ($c<20){$out.="$i, ";}
+ $c++;
+}
+
+$out=~s/, $//;
+print "$out\n";
\ No newline at end of file |
