aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <mohammad.anwar@yahoo.com>2022-07-04 22:02:11 +0100
committerMohammad S Anwar <mohammad.anwar@yahoo.com>2022-07-04 22:02:11 +0100
commit62c9865aed3c8c5781d0c18fc7e7bd6949311202 (patch)
treee8c69ef0c6bdb147dc50b30610799970bc369ea0
parent6601ca38ab5348458c66c01f27d1083d86cd5d8d (diff)
downloadperlweeklychallenge-club-62c9865aed3c8c5781d0c18fc7e7bd6949311202.tar.gz
perlweeklychallenge-club-62c9865aed3c8c5781d0c18fc7e7bd6949311202.tar.bz2
perlweeklychallenge-club-62c9865aed3c8c5781d0c18fc7e7bd6949311202.zip
- Added solutions by Robert DiCicco.
-rw-r--r--challenge-172/robert-dicicco/perl/ch-1.pl40
-rw-r--r--challenge-172/robert-dicicco/perl/ch-2.pl44
-rw-r--r--challenge-172/robert-dicicco/raku/ch-1.raku19
-rw-r--r--stats/pwc-current.json135
-rw-r--r--stats/pwc-language-breakdown-summary.json42
-rw-r--r--stats/pwc-language-breakdown.json1186
-rw-r--r--stats/pwc-leaders.json750
-rw-r--r--stats/pwc-summary-1-30.json114
-rw-r--r--stats/pwc-summary-121-150.json34
-rw-r--r--stats/pwc-summary-151-180.json36
-rw-r--r--stats/pwc-summary-181-210.json42
-rw-r--r--stats/pwc-summary-211-240.json40
-rw-r--r--stats/pwc-summary-241-270.json46
-rw-r--r--stats/pwc-summary-31-60.json118
-rw-r--r--stats/pwc-summary-61-90.json126
-rw-r--r--stats/pwc-summary-91-120.json42
-rw-r--r--stats/pwc-summary.json42
17 files changed, 1489 insertions, 1367 deletions
diff --git a/challenge-172/robert-dicicco/perl/ch-1.pl b/challenge-172/robert-dicicco/perl/ch-1.pl
new file mode 100644
index 0000000000..633321ea32
--- /dev/null
+++ b/challenge-172/robert-dicicco/perl/ch-1.pl
@@ -0,0 +1,40 @@
+#!perl.exe
+
+use strict;
+use warnings;
+use ntheory qw /is_prime divisors/;
+use Math::Combinatorics;
+
+# AUTHOR: Robert DiCicco
+# DATE: 2022-07-04
+# Challange 172 Prime Partition ( Perl )
+
+my @arr = (); # array to hold divisors
+my $m = $ARGV[0]; # number to test
+my $n = $ARGV[1]; # how many factors to sum
+
+sub CreateCombinations {
+ my $combinat = Math::Combinatorics->new(count => $n,
+ data => [@arr],
+ );
+
+ while(my @combo = $combinat->next_combination){ # create combinations of $n size
+ @combo = sort { $a <=> $b } @combo; # sort, just for appearances
+ my $sum = eval join '+', @combo; # sum them
+
+ if($sum == $m){ # print if sum = $m
+ print join(' ', @combo)."\n";
+ }
+
+ }
+}
+
+ for(my $p = 1; $p < $m; $p++) {
+
+ if (is_prime($p)) { push(@arr, $p) }
+
+ }
+
+print("\$m = $m; \$n = $n\n");
+
+CreateCombinations();
diff --git a/challenge-172/robert-dicicco/perl/ch-2.pl b/challenge-172/robert-dicicco/perl/ch-2.pl
new file mode 100644
index 0000000000..8adafb2893
--- /dev/null
+++ b/challenge-172/robert-dicicco/perl/ch-2.pl
@@ -0,0 +1,44 @@
+#!perl.exe
+
+use strict;
+use warnings;
+use List::Util qw(min max);
+use Statistics::Basic qw(median);
+use List::MoreUtils qw(first_index);
+
+# AUTHOR: Robert DiCicco
+# DATE: 2022-07-04
+# Challenge 172 Five Number Summary ( Perl )
+
+my @arr = (1, 2, 5, 6, 7, 9, 12, 15, 18, 19, 27);
+my @lower = ();
+my @upper = ();
+
+@arr = sort { $a <=> $b } @arr;
+
+my $med = median(@arr);
+my $min = min(@arr);
+my $max = max(@arr);
+
+my $med_index = first_index { $_ eq $med } @arr;
+my $max_index = first_index { $_ eq $max } @arr;
+
+for(my $x = 0; $x < $med_index; $x++){
+ push(@lower, $arr[$x]);
+}
+
+for(my $x = $med_index+1; $x <= $max_index; $x++){
+ push(@upper, $arr[$x]);
+}
+
+my $q1 = median(@lower);
+my $q3 = median(@upper);
+
+print("\( ");
+foreach(@arr){
+ print("$_ ");
+}
+
+print("\)\n");
+
+print("min = $min; q1 = $q1; median = $med; q3 = $q3; max = $max\n");
diff --git a/challenge-172/robert-dicicco/raku/ch-1.raku b/challenge-172/robert-dicicco/raku/ch-1.raku
new file mode 100644
index 0000000000..6ea8304b4a
--- /dev/null
+++ b/challenge-172/robert-dicicco/raku/ch-1.raku
@@ -0,0 +1,19 @@
+use v6;
+
+# AUTHOR: Robert DiCicco
+# DATE: 2022-07-04
+# Challenge 172 Prime Partition ( Raku )
+
+my @arr = (); # result array
+
+sub MAIN( Int $m, Int $n ) { # $n = number to test, $n = how many factors to sum
+ for 1..$m -> $p {
+ if ($p.is-prime) { @arr.push: $p }
+ }
+
+ for @arr.combinations($n) { # for each combination of size $n
+ if $_.sum == $m { # print if sum = $m
+ say $_;
+ }
+ }
+}
diff --git a/stats/pwc-current.json b/stats/pwc-current.json
index 8cb1f297d9..720dfa1308 100644
--- a/stats/pwc-current.json
+++ b/stats/pwc-current.json
@@ -1,74 +1,58 @@
{
+ "yAxis" : {
+ "title" : {
+ "text" : "Total Solutions"
+ }
+ },
"chart" : {
"type" : "column"
},
- "series" : [
- {
- "name" : "The Weekly Challenge - 172",
- "colorByPoint" : 1,
- "data" : [
- {
- "name" : "Mark Anderson",
- "y" : 2,
- "drilldown" : "Mark Anderson"
- },
- {
- "name" : "PokGoPun",
- "y" : 2,
- "drilldown" : "PokGoPun"
- },
- {
- "drilldown" : "Roger Bell_West",
- "y" : 4,
- "name" : "Roger Bell_West"
- },
- {
- "name" : "W. Luis Mochan",
- "y" : 3,
- "drilldown" : "W. Luis Mochan"
- }
- ]
+ "plotOptions" : {
+ "series" : {
+ "dataLabels" : {
+ "format" : "{point.y}",
+ "enabled" : 1
+ },
+ "borderWidth" : 0
}
- ],
- "legend" : {
- "enabled" : 0
- },
- "tooltip" : {
- "headerFormat" : "<span style='font-size:11px'>{series.name}</span><br/>",
- "pointFormat" : "<span style='color:{point.color}'>{point.name}</span>: <b>{point.y:f}</b><br/>",
- "followPointer" : 1
- },
- "title" : {
- "text" : "The Weekly Challenge - 172"
- },
- "subtitle" : {
- "text" : "[Champions: 4] Last updated at 2022-07-04 20:35:19 GMT"
},
"drilldown" : {
"series" : [
{
"name" : "Mark Anderson",
+ "id" : "Mark Anderson",
"data" : [
[
"Raku",
2
]
- ],
- "id" : "Mark Anderson"
+ ]
},
{
"name" : "PokGoPun",
+ "id" : "PokGoPun",
"data" : [
[
"Perl",
2
]
+ ]
+ },
+ {
+ "data" : [
+ [
+ "Perl",
+ 2
+ ],
+ [
+ "Raku",
+ 1
+ ]
],
- "id" : "PokGoPun"
+ "id" : "Robert DiCicco",
+ "name" : "Robert DiCicco"
},
{
- "name" : "Roger Bell_West",
- "id" : "Roger Bell_West",
"data" : [
[
"Perl",
@@ -78,10 +62,11 @@
"Raku",
2
]
- ]
+ ],
+ "id" : "Roger Bell_West",
+ "name" : "Roger Bell_West"
},
{
- "id" : "W. Luis Mochan",
"data" : [
[
"Perl",
@@ -92,25 +77,59 @@
1
]
],
+ "id" : "W. Luis Mochan",
"name" : "W. Luis Mochan"
}
]
},
- "yAxis" : {
- "title" : {
- "text" : "Total Solutions"
- }
+ "title" : {
+ "text" : "The Weekly Challenge - 172"
+ },
+ "legend" : {
+ "enabled" : 0
},
"xAxis" : {
"type" : "category"
},
- "plotOptions" : {
- "series" : {
- "borderWidth" : 0,
- "dataLabels" : {
- "enabled" : 1,
- "format" : "{point.y}"
- }
+ "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
+ },
+ "series" : [
+ {
+ "data" : [
+ {
+ "drilldown" : "Mark Anderson",
+ "y" : 2,
+ "name" : "Mark Anderson"
+ },
+ {
+ "name" : "PokGoPun",
+ "y" : 2,
+ "drilldown" : "PokGoPun"
+ },
+ {
+ "drilldown" : "Robert DiCicco",
+ "y" : 3,
+ "name" : "Robert DiCicco"
+ },
+ {
+ "name" : "Roger Bell_West",
+ "y" : 4,
+ "drilldown" : "Roger Bell_West"
+ },
+ {
+ "y" : 3,
+ "name" : "W. Luis Mochan",
+ "drilldown" : "W. Luis Mochan"
+ }
+ ],
+ "colorByPoint" : 1,
+ "name" : "The Weekly Challenge - 172"
}
+ ],
+ "subtitle" : {
+ "text" : "[Champions: 5] Last updated at 2022-07-04 20:57:22 GMT"
}
}
diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json
index 31ebc18a96..7b15f1e0e9 100644
--- a/stats/pwc-language-breakdown-summary.json
+++ b/stats/pwc-language-breakdown-summary.json
@@ -1,4 +1,7 @@
{
+ "subtitle" : {
+ "text" : "Last updated at 2022-07-04 20:57:22 GMT"
+ },
"tooltip" : {
"pointFormat" : "<b>{point.y:.0f}</b>"
},
@@ -6,16 +9,16 @@
{
"name" : "Contributions",
"dataLabels" : {
- "align" : "right",
- "format" : "{point.y:.0f}",
"y" : 10,
+ "color" : "#FFFFFF",
"style" : {
"fontSize" : "13px",
"fontFamily" : "Verdana, sans-serif"
},
- "enabled" : "true",
+ "format" : "{point.y:.0f}",
"rotation" : -90,
- "color" : "#FFFFFF"
+ "enabled" : "true",
+ "align" : "right"
},
"data" : [
[
@@ -24,40 +27,37 @@
],
[
"Perl",
- 8355
+ 8357
],
[
"Raku",
- 4966
+ 4967
]
]
}
],
- "legend" : {
- "enabled" : "false"
- },
- "title" : {
- "text" : "The Weekly Challenge Contributions [2019 - 2022]"
- },
- "chart" : {
- "type" : "column"
- },
"xAxis" : {
"type" : "category",
"labels" : {
"style" : {
- "fontSize" : "13px",
- "fontFamily" : "Verdana, sans-serif"
+ "fontFamily" : "Verdana, sans-serif",
+ "fontSize" : "13px"
}
}
},
+ "legend" : {
+ "enabled" : "false"
+ },
+ "title" : {
+ "text" : "The Weekly Challenge Contributions [2019 - 2022]"
+ },
"yAxis" : {
+ "min" : 0,
"title" : {
"text" : null
- },
- "min" : 0
+ }
},
- "subtitle" : {
- "text" : "Last updated at 2022-07-04 20:35:19 GMT"
+ "chart" : {
+ "type" : "column"
}
}
diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json
index a5fdb003d2..1ad0d719e7 100644
--- a/stats/pwc-language-breakdown.json
+++ b/stats/pwc-language-breakdown.json
@@ -1,11 +1,26 @@
{
- "subtitle" : {
- "text" : "Click the columns to drilldown the language breakdown. Last updated at 2022-07-04 20:35:19 GMT"
+ "yAxis" : {
+ "title" : {
+ "text" : "Total Solutions"
+ }
+ },
+ "chart" : {
+ "type" : "column"
+ },
+ "plotOptions" : {
+ "series" : {
+ "dataLabels" : {
+ "enabled" : 1,
+ "format" : "{point.y}"
+ },
+ "borderWidth" : 0
+ }
},
"drilldown" : {
"series" : [
{
"name" : "001",
+ "id" : "001",
"data" : [
[
"Perl",
@@ -19,11 +34,9 @@
"Blog",
11
]
- ],
- "id" : "001"
+ ]
},
{
- "name" : "002",
"data" : [
[
"Perl",
@@ -38,6 +51,7 @@
10
]
],
+ "name" : "002",
"id" : "002"
},
{
@@ -78,6 +92,7 @@
},
{
"name" : "005",
+ "id" : "005",
"data" : [
[
"Perl",
@@ -91,10 +106,10 @@
"Blog",
12
]
- ],
- "id" : "005"
+ ]
},
{
+ "name" : "006",
"id" : "006",
"data" : [
[
@@ -109,12 +124,9 @@
"Blog",
7
]
- ],
- "name" : "006"
+ ]
},
{
- "name" : "007",
- "id" : "007",
"data" : [
[
"Perl",
@@ -128,10 +140,11 @@
"Blog",
10
]
- ]
+ ],
+ "id" : "007",
+ "name" : "007"
},
{
- "id" : "008",
"data" : [
[
"Perl",
@@ -146,11 +159,10 @@
12
]
],
+ "id" : "008",
"name" : "008"
},
{
- "name" : "009",
- "id" : "009",
"data" : [
[
"Perl",
@@ -164,10 +176,13 @@
"Blog",
13
]
- ]
+ ],
+ "name" : "009",
+ "id" : "009"
},
{
"name" : "010",
+ "id" : "010",
"data" : [
[
"Perl",
@@ -181,12 +196,9 @@
"Blog",
11
]
- ],
- "id" : "010"
+ ]
},
{
- "name" : "011",
- "id" : "011",
"data" : [
[
"Perl",
@@ -200,7 +212,9 @@
"Blog",
10
]
- ]
+ ],
+ "id" : "011",
+ "name" : "011"
},
{
"name" : "012",
@@ -221,8 +235,6 @@
]
},
{
- "name" : "013",
- "id" : "013",
"data" : [
[
"Perl",
@@ -236,9 +248,13 @@
"Blog",
13
]
- ]
+ ],
+ "name" : "013",
+ "id" : "013"
},
{
+ "name" : "014",
+ "id" : "014",
"data" : [
[
"Perl",
@@ -252,9 +268,7 @@
"Blog",
15
]
- ],
- "id" : "014",
- "name" : "014"
+ ]
},
{
"data" : [
@@ -275,7 +289,6 @@
"name" : "015"
},
{
- "name" : "016",
"data" : [
[
"Perl",
@@ -290,7 +303,8 @@
12
]
],
- "id" : "016"
+ "id" : "016",
+ "name" : "016"
},
{
"data" : [
@@ -311,8 +325,6 @@
"name" : "017"
},
{
- "name" : "018",
- "id" : "018",
"data" : [
[
"Perl",
@@ -326,9 +338,13 @@
"Blog",
14
]
- ]
+ ],
+ "id" : "018",
+ "name" : "018"
},
{
+ "id" : "019",
+ "name" : "019",
"data" : [
[
"Perl",
@@ -342,12 +358,9 @@
"Blog",
13
]
- ],
- "id" : "019",
- "name" : "019"
+ ]
},
{
- "name" : "020",
"data" : [
[
"Perl",
@@ -362,10 +375,12 @@
13
]
],
+ "name" : "020",
"id" : "020"
},
{
"id" : "021",
+ "name" : "021",
"data" : [
[
"Perl",
@@ -379,12 +394,9 @@
"Blog",
10
]
- ],
- "name" : "021"
+ ]
},
{
- "name" : "022",
- "id" : "022",
"data" : [
[
"Perl",
@@ -398,9 +410,13 @@
"Blog",
10
]
- ]
+ ],
+ "id" : "022",
+ "name" : "022"
},
{
+ "id" : "023",
+ "name" : "023",
"data" : [
[
"Perl",
@@ -414,9 +430,7 @@
"Blog",
12
]
- ],
- "id" : "023",
- "name" : "023"
+ ]
},
{
"data" : [
@@ -433,11 +447,10 @@
11
]
],
- "id" : "024",
- "name" : "024"
+ "name" : "024",
+ "id" : "024"
},
{
- "name" : "025",
"data" : [
[
"Perl",
@@ -452,9 +465,11 @@
12
]
],
- "id" : "025"
+ "id" : "025",
+ "name" : "025"
},
{
+ "id" : "026",
"name" : "026",
"data" : [
[
@@ -469,8 +484,7 @@
"Blog",
10
]
- ],
- "id" : "026"
+ ]
},
{
"data" : [
@@ -487,11 +501,12 @@
9
]
],
- "id" : "027",
- "name" : "027"
+ "name" : "027",
+ "id" : "027"
},
{
"name" : "028",
+ "id" : "028",
"data" : [
[
"Perl",
@@ -505,11 +520,11 @@
"Blog",
9
]
- ],
- "id" : "028"
+ ]
},
{
"id" : "029",
+ "name" : "029",
"data" : [
[
"Perl",
@@ -523,10 +538,10 @@
"Blog",
12
]
- ],
- "name" : "029"
+ ]
},
{
+ "name" : "030",
"id" : "030",
"data" : [
[
@@ -541,11 +556,11 @@
"Blog",
10
]
- ],
- "name" : "030"
+ ]
},
{
"id" : "031",
+ "name" : "031",
"data" : [
[
"Perl",
@@ -559,10 +574,10 @@
"Blog",
9
]
- ],
- "name" : "031"
+ ]
},
{
+ "name" : "032",
"id" : "032",
"data" : [
[
@@ -577,11 +592,11 @@
"Blog",
10
]
- ],
- "name" : "032"
+ ]
},
{
"name" : "033",
+ "id" : "033",
"data" : [
[
"Perl",
@@ -595,8 +610,7 @@
"Blog",
10
]
- ],
- "id" : "033"
+ ]
},
{
"data" : [
@@ -613,11 +627,10 @@
11
]
],
- "id" : "034",
- "name" : "034"
+ "name" : "034",
+ "id" : "034"
},
{
- "id" : "035",
"data" : [
[
"Perl",
@@ -632,6 +645,7 @@
9
]
],
+ "id" : "035",
"name" : "035"
},
{
@@ -649,11 +663,10 @@
11
]
],
- "id" : "036",
- "name" : "036"
+ "name" : "036",
+ "id" : "036"
},
{
- "name" : "037",
"data" : [
[
"Perl",
@@ -668,11 +681,10 @@
9
]
],
+ "name" : "037",
"id" : "037"
},
{
- "name" : "038",
- "id" : "038",
"data" : [
[
"Perl",
@@ -686,11 +698,13 @@
"Blog",
12
]
- ]
+ ],
+ "id" : "038",
+ "name" : "038"
},
{
- "name" : "039",
"id" : "039",
+ "name" : "039",
"data" : [
[
"Perl",
@@ -743,6 +757,7 @@
]
},
{
+ "id" : "042",
"name" : "042",
"data" : [
[
@@ -757,11 +772,11 @@
"Blog",
11
]
- ],
- "id" : "042"
+ ]
},
{
"id" : "043",
+ "name" : "043",
"data" : [
[
"Perl",
@@ -775,8 +790,7 @@
"Blog",
11
]
- ],
- "name" : "043"
+ ]
},
{
"name" : "044",
@@ -797,6 +811,7 @@
]
},
{
+ "name" : "045",
"id" : "045",
"data" : [
[
@@ -811,11 +826,9 @@
"Blog",
11
]
- ],
- "name" : "045"
+ ]
},
{
- "name" : "046",
"data" : [
[
"Perl",
@@ -830,9 +843,11 @@
10
]
],
- "id" : "046"
+ "id" : "046",
+ "name" : "046"
},
{
+ "id" : "047",
"name" : "047",
"data" : [
[
@@ -847,11 +862,11 @@
"Blog",
10
]
- ],
- "id" : "047"
+ ]
},
{
"name" : "048",
+ "id" : "048",
"data" : [
[
"Perl",
@@ -865,11 +880,11 @@
"Blog",
12
]
- ],
- "id" : "048"
+ ]
},
{
"name" : "049",
+ "id" : "049",
"data" : [
[
"Perl",
@@ -883,12 +898,11 @@
"Blog",
12
]
- ],
- "id" : "049"
+ ]
},
{
- "name" : "050",
"id" : "050",
+ "name" : "050",
"data" : [
[
"Perl",
@@ -905,6 +919,8 @@
]
},
{
+ "name" : "051",
+ "id" : "051",
"data" : [
[
"Perl",
@@ -918,12 +934,9 @@
"Blog",
11
]
- ],
- "id" : "051",
- "name" : "051"
+ ]
},
{
- "name" : "052",
"data" : [
[
"Perl",
@@ -938,11 +951,10 @@
14
]
],
- "id" : "052"
+ "id" : "052",
+ "name" : "052"
},
{
- "name" : "053",
- "id" : "053",
"data" : [
[
"Perl",
@@ -956,11 +968,13 @@
"Blog",
15
]
- ]
+ ],
+ "id" : "053",
+ "name" : "053"
},
{
- "name" : "054",
"id" : "054",
+ "name" : "054",
"data" : [
[
"Perl",
@@ -977,7 +991,6 @@
]
},
{
- "name" : "055",
"data" : [
[
"Perl",
@@ -992,6 +1005,7 @@
14
]
],
+ "name" : "055",
"id" : "055"
},
{
@@ -1009,8 +1023,8 @@
16
]
],
- "id" : "056",
- "name" : "056"
+ "name" : "056",
+ "id" : "056"
},
{
"data" : [
@@ -1031,6 +1045,7 @@
"name" : "057"
},
{
+ "id" : "058",
"name" : "058",
"data" : [
[
@@ -1045,11 +1060,9 @@
"Blog",
13
]
- ],
- "id" : "058"
+ ]
},
{
- "name" : "059",
"data" : [
[
"Perl",
@@ -1064,9 +1077,12 @@
16
]
],
- "id" : "059"
+ "id" : "059",
+ "name" : "059"
},
{
+ "id" : "060",
+ "name" : "060",
"data" : [
[
"Perl",
@@ -1080,12 +1096,9 @@
"Blog",
16
]
- ],
- "id" : "060",
- "name" : "060"
+