aboutsummaryrefslogtreecommitdiff
path: root/challenge-169
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-169')
-rw-r--r--challenge-169/dario-mazzeo/README1
-rwxr-xr-xchallenge-169/dario-mazzeo/perl/ch-1.pl24
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