aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <mohammad.anwar@yahoo.com>2022-03-29 23:47:33 +0100
committerMohammad S Anwar <mohammad.anwar@yahoo.com>2022-03-29 23:47:33 +0100
commit5002c9e2bcf431285b74dd9fc51d0f62843abdb1 (patch)
tree2fac283bb078e41649b88169686d27d252502019
parent1ed331bfb0cf6fb4fe4c3023c9837cdee8eb616e (diff)
downloadperlweeklychallenge-club-5002c9e2bcf431285b74dd9fc51d0f62843abdb1.tar.gz
perlweeklychallenge-club-5002c9e2bcf431285b74dd9fc51d0f62843abdb1.tar.bz2
perlweeklychallenge-club-5002c9e2bcf431285b74dd9fc51d0f62843abdb1.zip
- Added solutions to task 1 of week 158.
-rw-r--r--challenge-158/mohammad-anwar/perl/ch-1.pl62
-rw-r--r--challenge-158/mohammad-anwar/raku/ch-1.raku50
-rw-r--r--stats/pwc-current.json157
-rw-r--r--stats/pwc-language-breakdown-summary.json58
-rw-r--r--stats/pwc-language-breakdown.json1086
-rw-r--r--stats/pwc-leaders.json362
-rw-r--r--stats/pwc-summary-1-30.json44
-rw-r--r--stats/pwc-summary-121-150.json36
-rw-r--r--stats/pwc-summary-151-180.json48
-rw-r--r--stats/pwc-summary-181-210.json100
-rw-r--r--stats/pwc-summary-211-240.json100
-rw-r--r--stats/pwc-summary-241-270.json22
-rw-r--r--stats/pwc-summary-31-60.json104
-rw-r--r--stats/pwc-summary-61-90.json108
-rw-r--r--stats/pwc-summary-91-120.json100
-rw-r--r--stats/pwc-summary.json48
16 files changed, 1308 insertions, 1177 deletions
diff --git a/challenge-158/mohammad-anwar/perl/ch-1.pl b/challenge-158/mohammad-anwar/perl/ch-1.pl
new file mode 100644
index 0000000000..21f2684470
--- /dev/null
+++ b/challenge-158/mohammad-anwar/perl/ch-1.pl
@@ -0,0 +1,62 @@
+#!/usr/bin/perl
+
+=head1
+
+Week 158:
+
+ https://theweeklychallenge.org/blog/perl-weekly-challenge-158
+
+Task #1: Additive Primes
+
+ Write a script to find out all Additive Primes <= 100.
+
+=cut
+
+use strict;
+use warnings;
+use Test::More;
+
+is_deeply(
+ additive_primes(100),
+ [ 2, 3, 5, 7, 11, 23, 29, 41, 43, 47, 61, 67, 83, 89 ],
+ 'Example'
+);
+
+done_testing;
+
+#
+#
+# METHODS
+
+sub additive_primes {
+ my ($n) = @_;
+
+ my $i = 1;
+ my $ap = [];
+
+ while ($i <= $n) {
+ my $s = 0;
+
+ ($i > 10)
+ && do { $s += $_ for (split //, $i); };
+
+ (is_prime($i))
+ && do { push @$ap, $i if (($s == 0) || is_prime($s)); };
+
+ $i++;
+ }
+
+ return $ap;
+}
+
+sub is_prime {
+ my ($n) = @_;
+
+ return 0 if ($n == 1);
+
+ foreach my $i (2 .. sqrt $n) {
+ return 0 unless $n % $i
+ }
+
+ return 1;
+}
diff --git a/challenge-158/mohammad-anwar/raku/ch-1.raku b/challenge-158/mohammad-anwar/raku/ch-1.raku
new file mode 100644
index 0000000000..dd303a3eea
--- /dev/null
+++ b/challenge-158/mohammad-anwar/raku/ch-1.raku
@@ -0,0 +1,50 @@
+#!/usr/bin/env raku
+
+=begin pod
+
+Week 158:
+
+ https://theweeklychallenge.org/blog/perl-weekly-challenge-158
+
+Task #1: Additive Primes
+
+ Write a script to find out all Additive Primes <= 100.
+
+=end pod
+
+use Test;
+
+is-deeply
+ additive-primes(100),
+ [ 2, 3, 5, 7, 11, 23, 29, 41, 43, 47, 61, 67, 83, 89 ],
+ 'Example';
+
+done-testing;
+
+#
+#
+# METHOD
+
+sub additive-primes(Int $n) {
+
+ my $i = 1;
+ my $ap = [];
+
+ while ($i <= $n) {
+ my $s = 0;
+
+ if ($i > 10) {
+ $s += $_ for ($i.split(""));
+ }
+
+ if ($i.is-prime) {
+ if (($s == 0) || (($s > 0) && $s.is-prime)) {
+ $ap.push: $i;
+ }
+ }
+
+ $i++;
+ }
+
+ return $ap;
+}
diff --git a/stats/pwc-current.json b/stats/pwc-current.json
index dac4f6bfb5..29d7c983d8 100644
--- a/stats/pwc-current.json
+++ b/stats/pwc-current.json
@@ -1,35 +1,38 @@
{
- "yAxis" : {
- "title" : {
- "text" : "Total Solutions"
+ "plotOptions" : {
+ "series" : {
+ "borderWidth" : 0,
+ "dataLabels" : {
+ "format" : "{point.y}",
+ "enabled" : 1
+ }
}
},
- "tooltip" : {
- "pointFormat" : "<span style='color:{point.color}'>{point.name}</span>: <b>{point.y:f}</b><br/>",
- "headerFormat" : "<span style='font-size:11px'>{series.name}</span><br/>",
- "followPointer" : 1
+ "xAxis" : {
+ "type" : "category"
},
"legend" : {
"enabled" : 0
},
+ "chart" : {
+ "type" : "column"
+ },
"subtitle" : {
- "text" : "[Champions: 14] Last updated at 2022-03-29 15:28:05 GMT"
+ "text" : "[Champions: 15] Last updated at 2022-03-29 22:45:27 GMT"
},
"drilldown" : {
"series" : [
{
+ "name" : "Ali Moradi",
"id" : "Ali Moradi",
"data" : [
[
"Perl",
2
]
- ],
- "name" : "Ali Moradi"
+ ]
},
{
- "id" : "Dave Jacoby",
- "name" : "Dave Jacoby",
"data" : [
[
"Perl",
@@ -39,7 +42,9 @@
"Blog",
1
]
- ]
+ ],
+ "name" : "Dave Jacoby",
+ "id" : "Dave Jacoby"
},
{
"data" : [
@@ -52,8 +57,8 @@
1
]
],
- "name" : "James Smith",
- "id" : "James Smith"
+ "id" : "James Smith",
+ "name" : "James Smith"
},
{
"data" : [
@@ -71,13 +76,13 @@
},
{
"id" : "Mark Anderson",
+ "name" : "Mark Anderson",
"data" : [
[
"Raku",
2
]
- ],
- "name" : "Mark Anderson"
+ ]
},
{
"data" : [
@@ -90,18 +95,32 @@
"id" : "Marton Polgar"
},
{
- "id" : "Matthew Neleigh",
"data" : [
[
"Perl",
2
]
],
+ "id" : "Matthew Neleigh",
"name" : "Matthew Neleigh"
},
{
- "id" : "Niels van Dijke",
+ "data" : [
+ [
+ "Perl",
+ 1
+ ],
+ [
+ "Raku",
+ 1
+ ]
+ ],
+ "id" : "Mohammad S Anwar",
+ "name" : "Mohammad S Anwar"
+ },
+ {
"name" : "Niels van Dijke",
+ "id" : "Niels van Dijke",
"data" : [
[
"Perl",
@@ -110,17 +129,16 @@
]
},
{
+ "name" : "PokGoPun",
+ "id" : "PokGoPun",
"data" : [
[
"Perl",
2
]
- ],
- "name" : "PokGoPun",
- "id" : "PokGoPun"
+ ]
},
{
- "name" : "Robert DiCicco",
"data" : [
[
"Perl",
@@ -131,20 +149,20 @@
2
]
],
+ "name" : "Robert DiCicco",
"id" : "Robert DiCicco"
},
{
"id" : "Robert Ransbottom",
+ "name" : "Robert Ransbottom",
"data" : [
[
"Raku",
2
]
- ],
- "name" : "Robert Ransbottom"
+ ]
},
{
- "name" : "Roger Bell_West",
"data" : [
[
"Perl",
@@ -155,9 +173,12 @@
2
]
],
+ "name" : "Roger Bell_West",
"id" : "Roger Bell_West"
},
{
+ "name" : "Ulrich Rieke",
+ "id" : "Ulrich Rieke",
"data" : [
[
"Perl",
@@ -167,12 +188,9 @@
"Raku",
2
]
- ],
- "name" : "Ulrich Rieke",
- "id" : "Ulrich Rieke"
+ ]
},
{
- "id" : "W. Luis Mochan",
"data" : [
[
"Perl",
@@ -183,64 +201,62 @@
1
]
],
- "name" : "W. Luis Mochan"
+ "name" : "W. Luis Mochan",
+ "id" : "W. Luis Mochan"
}
]
},
+ "tooltip" : {
+ "followPointer" : 1,
+ "pointFormat" : "<span style='color:{point.color}'>{point.name}</span>: <b>{point.y:f}</b><br/>",
+ "headerFormat" : "<span style='font-size:11px'>{series.name}</span><br/>"
+ },
"title" : {
"text" : "The Weekly Challenge - 158"
},
- "xAxis" : {
- "type" : "category"
- },
- "plotOptions" : {
- "series" : {
- "borderWidth" : 0,
- "dataLabels" : {
- "format" : "{point.y}",
- "enabled" : 1
- }
- }
- },
"series" : [
{
"colorByPoint" : 1,
- "name" : "The Weekly Challenge - 158",
"data" : [
{
- "y" : 2,
"drilldown" : "Ali Moradi",
+ "y" : 2,
"name" : "Ali Moradi"
},
{
- "name" : "Dave Jacoby",
"drilldown" : "Dave Jacoby",
- "y" : 3
+ "y" : 3,
+ "name" : "Dave Jacoby"
},
{
- "name" : "James Smith",
"drilldown" : "James Smith",
- "y" : 3
+ "y" : 3,
+ "name" : "James Smith"
},
{
+ "drilldown" : "Luca Ferrari",
"y" : 8,
- "name" : "Luca Ferrari",
- "drilldown" : "Luca Ferrari"
+ "name" : "Luca Ferrari"
},
{
- "y" : 2,
+ "name" : "Mark Anderson",
"drilldown" : "Mark Anderson",
- "name" : "Mark Anderson"
+ "y" : 2
},
{
- "name" : "Marton Polgar",
+ "y" : 2,
"drilldown" : "Marton Polgar",
+ "name" : "Marton Polgar"
+ },
+ {
+ "name" : "Matthew Neleigh",
+ "drilldown" : "Matthew Neleigh",
"y" : 2
},
{
"y" : 2,
- "name" : "Matthew Neleigh",
- "drilldown" : "Matthew Neleigh"
+ "drilldown" : "Mohammad S Anwar",
+ "name" : "Mohammad S Anwar"
},
{
"name" : "Niels van Dijke",
@@ -248,39 +264,42 @@
"y" : 2
},
{
- "y" : 2,
"drilldown" : "PokGoPun",
+ "y" : 2,
"name" : "PokGoPun"
},
{
- "y" : 4,
"drilldown" : "Robert DiCicco",
- "name" : "Robert DiCicco"
+ "name" : "Robert DiCicco",
+ "y" : 4
},
{
"drilldown" : "Robert Ransbottom",
- "name" : "Robert Ransbottom",
- "y" : 2
+ "y" : 2,
+ "name" : "Robert Ransbottom"
},
{
- "y" : 4,
+ "name" : "Roger Bell_West",
"drilldown" : "Roger Bell_West",
- "name" : "Roger Bell_West"
+ "y" : 4
},
{
- "drilldown" : "Ulrich Rieke",
"name" : "Ulrich Rieke",
+ "drilldown" : "Ulrich Rieke",
"y" : 4
},
{
- "y" : 3,
+ "name" : "W. Luis Mochan",
"drilldown" : "W. Luis Mochan",
- "name" : "W. Luis Mochan"
+ "y" : 3
}
- ]
+ ],
+ "name" : "The Weekly Challenge - 158"
}
],
- "chart" : {
- "type" : "column"
+ "yAxis" : {
+ "title" : {
+ "text" : "Total Solutions"
+ }
}
}
diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json
index 4b6278c2c9..cb3735f5a4 100644
--- a/stats/pwc-language-breakdown-summary.json
+++ b/stats/pwc-language-breakdown-summary.json
@@ -1,33 +1,19 @@
{
"subtitle" : {
- "text" : "Last updated at 2022-03-29 15:28:05 GMT"
+ "text" : "Last updated at 2022-03-29 22:45:27 GMT"
},
"yAxis" : {
- "min" : 0,
"title" : {
"text" : null
- }
+ },
+ "min" : 0
},
- "tooltip" : {
- "pointFormat" : "<b>{point.y:.0f}</b>"
- },
- "legend" : {
- "enabled" : "false"
+ "title" : {
+ "text" : "The Weekly Challenge Contributions [2019 - 2022]"
},
"series" : [
{
- "dataLabels" : {
- "enabled" : "true",
- "y" : 10,
- "rotation" : -90,
- "format" : "{point.y:.0f}",
- "align" : "right",
- "style" : {
- "fontSize" : "13px",
- "fontFamily" : "Verdana, sans-serif"
- },
- "color" : "#FFFFFF"
- },
+ "name" : "Contributions",
"data" : [
[
"Blog",
@@ -35,29 +21,43 @@
],
[
"Perl",
- 7610
+ 7611
],
[
"Raku",
- 4562
+ 4563
]
],
- "name" : "Contributions"
+ "dataLabels" : {
+ "enabled" : "true",
+ "style" : {
+ "fontSize" : "13px",
+ "fontFamily" : "Verdana, sans-serif"
+ },
+ "align" : "right",
+ "y" : 10,
+ "color" : "#FFFFFF",
+ "format" : "{point.y:.0f}",
+ "rotation" : -90
+ }
}
],
+ "tooltip" : {
+ "pointFormat" : "<b>{point.y:.0f}</b>"
+ },
"chart" : {
"type" : "column"
},
- "title" : {
- "text" : "The Weekly Challenge Contributions [2019 - 2022]"
+ "legend" : {
+ "enabled" : "false"
},
"xAxis" : {
- "type" : "category",
"labels" : {
"style" : {
- "fontSize" : "13px",
- "fontFamily" : "Verdana, sans-serif"
+ "fontFamily" : "Verdana, sans-serif",
+ "fontSize" : "13px"
}
- }
+ },
+ "type" : "category"
}
}
diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json
index e184ffd0ef..42d2dcbe11 100644
--- a/stats/pwc-language-breakdown.json
+++ b/stats/pwc-language-breakdown.json
@@ -1,23 +1,8 @@
{
- "yAxis" : {
- "title" : {
- "text" : "Total Solutions"
- }
- },
- "legend" : {
- "enabled" : "false"
- },
- "tooltip" : {
- "followPointer" : "true",
- "headerFormat" : "<span style=\"font-size:11px\"></span>",
- "pointFormat" : "<span style=\"color:{point.color}\">Challenge {point.name}</span>: <b>{point.y:f}</b><br/>"
- },
- "subtitle" : {
- "text" : "Click the columns to drilldown the language breakdown. Last updated at 2022-03-29 15:28:05 GMT"
- },
"drilldown" : {
"series" : [
{
+ "name" : "001",
"id" : "001",
"data" : [
[
@@ -32,12 +17,9 @@
"Blog",
11
]
- ],
- "name" : "001"
+ ]
},
{
- "id" : "002",
- "name" : "002",
"data" : [
[
"Perl",
@@ -51,11 +33,13 @@
"Blog",
10
]
- ]
+ ],
+ "id" : "002",
+ "name" : "002"
},
{
- "id" : "003",
"name" : "003",
+ "id" : "003",
"data" : [
[
"Perl",
@@ -72,8 +56,6 @@
]
},
{
- "id" : "004",
- "name" : "004",
"data" : [
[
"Perl",
@@ -87,9 +69,13 @@
"Blog",
10
]
- ]
+ ],
+ "id" : "004",
+ "name" : "004"
},
{
+ "name" : "005",
+ "id" : "005",
"data" : [
[
"Perl",
@@ -103,13 +89,9 @@
"Blog",
12
]
- ],
- "name" : "005",
- "id" : "005"
+ ]
},
{
- "id" : "006",
- "name" : "006",
"data" : [
[
"Perl",
@@ -123,10 +105,11 @@
"Blog",
7
]
- ]
+ ],
+ "id" : "006",
+ "name" : "006"
},
{
- "name" : "007",
"data" : [
[
"Perl",
@@ -141,9 +124,12 @@
10
]
],
+ "name" : "007",
"id" : "007"
},
{
+ "name" : "008",
+ "id" : "008",
"data" : [
[
"Perl",
@@ -157,11 +143,11 @@
"Blog",
12
]
- ],
- "name" : "008",
- "id" : "008"
+ ]
},
{
+ "id" : "009",
+ "name" : "009",
"data" : [
[
"Perl",
@@ -175,11 +161,10 @@
"Blog",
13
]
- ],
- "name" : "009",
- "id" : "009"
+ ]
},
{
+ "name" : "010",
"id" : "010",
"data" : [
[
@@ -194,11 +179,9 @@
"Blog",
11
]
- ],
- "name" : "010"
+ ]
},
{
- "id" : "011",
"data" : [
[
"Perl",
@@ -213,9 +196,11 @@
10
]
],
+ "id" : "011",
"name" : "011"
},
{
+ "name" : "012",
"id" : "012",
"data" : [
[
@@ -230,11 +215,9 @@
"Blog",
11
]
- ],
- "name" : "012"
+ ]
},
{
- "name" : "013",
"data" : [
[
"Perl",
@@ -249,10 +232,10 @@
13
]
],
- "id" : "013"
+ "id" : "013",
+ "name" : "013"
},
{
- "id" : "014",
"data" : [
[
"Perl",
@@ -267,11 +250,12 @@
15
]
],
- "name" : "014"
+ "name" : "014",
+ "id" : "014"
},
{
- "id" : "015",
"name" : "015",
+ "id" : "015",
"data" : [
[
"Perl",
@@ -288,6 +272,8 @@
]
},
{
+ "id" : "016",
+ "name" : "016",
"data" : [
[
"Perl",
@@ -301,11 +287,11 @@
"Blog",
12
]
- ],
- "name" : "016",
- "id" : "016"
+ ]
},
{
+ "id" : "017",
+ "name" : "017",
"data" : [
[
"Perl",
@@ -319,13 +305,9 @@
"Blog",
12
]
- ],
- "name" : "017",
- "id" : "017"
+ ]
},
{
- "id" : "018",
- "name" : "018",
"data" : [
[
"Perl",
@@ -339,7 +321,9 @@
"Blog",
14
]
- ]
+ ],
+ "id" : "018",
+ "name" : "018"
},
{
"id" : "019",
@@ -361,6 +345,7 @@
},
{
"id" : "020",
+ "name" : "020",
"data" : [
[
"Perl",
@@ -374,11 +359,9 @@
"Blog",
13
]
- ],
- "name" : "020"
+ ]
},
{
- "id" : "021",
"data" : [
[
"Perl",
@@ -393,7 +376,8 @@
10
]
],
- "name" : "021"
+ "name" : "021",
+ "id" : "021"
},
{
"id" : "022",
@@ -414,7 +398,6 @@
]
},
{
- "name" : "023",
"data" : [
[
"Perl",
@@ -429,9 +412,11 @@
12
]
],
+ "name" : "023",
"id" : "023"
},
{
+ "name" : "024",
"id" : "024",
"data" : [
[
@@ -446,11 +431,11 @@
"Blog",
11
]
- ],
- "name" : "024"
+ ]
},
{
"name" : "025",
+ "id" : "025",
"data" : [
[
"Perl",
@@ -464,10 +449,10 @@
"Blog",
12
]
- ],
- "id" : "025"
+ ]
},
{
+ "id" : "026",
"name" : "026",
"data" : [
[
@@ -482,8 +467,7 @@
"Blog",
10
]
- ],
- "id" : "026"
+ ]
},
{
"data" : [
@@ -505,6 +489,7 @@
},
{
"name" : "028",
+ "id" : "028",
"data" : [
[
"Perl",
@@ -518,11 +503,9 @@
"Blog",
9
]
- ],
- "id" : "028"
+ ]
},
{
- "name" : "029",
"data" : [
[
"Perl",
@@ -537,9 +520,11 @@
12
]
],
+ "name" : "029",
"id" : "029"
},
{
+ "name" : "030",
"id" : "030",
"data" : [
[
@@ -554,10 +539,11 @@
"Blog",
10
]
- ],
- "name" : "030"
+ ]
},
{
+ "name" : "031",
+ "id" : "031",
"data" : [
[
"Perl",
@@ -571,11 +557,10 @@
"Blog",
9
]
- ],
- "name" : "031",
- "id" : "031"
+ ]
},
{
+ "id" : "032",
"name" : "032",
"data" : [
[
@@ -590,11 +575,11 @@
"Blog",
10
]
- ],
- "id" : "032"
+ ]
},
{
"name" : "033",
+ "id" : "033",
"data" : [
[
"Perl",
@@ -608,11 +593,9 @@
"Blog",
10
]
- ],
- "id" : "033"
+ ]
},
{
- "name" : "034",
"data" : [
[
"Perl",
@@ -627,6 +610,7 @@
11
]
],
+ "name" : "034",
"id" : "034"
},
{
@@ -648,8 +632,6 @@
"id" : "035"
},
{
- "id" : "036",
- "name" : "036",
"data" : [
[
"Perl",
@@ -663,10 +645,13 @@
"Blog",
11
]
- ]
+ ],
+ "name" : "036",
+ "id" : "036"
},
{
"id" : "037",
+ "name" : "037",
"data" : [
[
"Perl",
@@ -680,11 +665,11 @@
"Blog",
9
]
- ],
- "name" : "037"
+ ]
},
{
"id" : "038",
+ "name" : "038",
"data" : [
[
"Perl",
@@ -698,11 +683,9 @@
"Blog",
12
]
- ],
- "name" : "038"
+ ]
},
{
- "id" : "039",
"data" : [
[
"Perl",
@@ -717,9 +700,11 @@
12
]
],
- "name" : "039"
+ "name" : "039",
+ "id" : "039"
},
{
+ "name" : "040",
"id" : "040",
"data" : [
[
@@ -734,11 +719,9 @@
"Blog",
10
]
- ],
- "name" : "040"
+ ]
},
{
- "name" : "041",
"data" : [
[
"Perl",
@@ -753,10 +736,10 @@
9
]
],
+ "name" : "041",
"id" : "041"
},
{
- "id" : "042",
"data" : [
[
"Perl",
@@ -771,10 +754,12 @@
11
]
],
+ "id" : "042",
"name" : "042"
},
{
"id" : "043",
+ "name" : "043",
"data" : [
[
"Perl",
@@ -788,12 +773,9 @@
"Blog",
11
]
- ],
- "name" : "043"
+ ]
},
{
- "id" : "044",
- "name" : "044",
"data" : [
[
"Perl",
@@ -807,11 +789,11 @@
"Blog",
11
]