diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2022-02-21 20:11:08 +0000 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2022-02-21 20:11:08 +0000 |
| commit | 9a09829259c888940dc5f171348777b34dd91cd3 (patch) | |
| tree | 3aae8885375ed5daa3ac751141816b78372f9981 | |
| parent | fe7cb6bc20a32829a8551c5a3b8b84cea5baa641 (diff) | |
| download | perlweeklychallenge-club-9a09829259c888940dc5f171348777b34dd91cd3.tar.gz perlweeklychallenge-club-9a09829259c888940dc5f171348777b34dd91cd3.tar.bz2 perlweeklychallenge-club-9a09829259c888940dc5f171348777b34dd91cd3.zip | |
- Added contributions by Robert DiCicco.
| -rw-r--r-- | challenge-153/robert-dicicco/perl/ch-1.pl | 23 | ||||
| -rw-r--r-- | challenge-153/robert-dicicco/perl/ch-2.pl | 41 | ||||
| -rw-r--r-- | challenge-153/robert-dicicco/raku/ch-1.raku | 24 | ||||
| -rw-r--r-- | challenge-153/robert-dicicco/raku/ch-2.raku | 36 | ||||
| -rw-r--r-- | challenge-153/robert-dicicco/ruby/ch-1.rb | 27 | ||||
| -rw-r--r-- | challenge-153/robert-dicicco/ruby/ch-2.rb | 39 | ||||
| -rw-r--r-- | stats/pwc-current.json | 115 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown-summary.json | 58 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown.json | 976 | ||||
| -rw-r--r-- | stats/pwc-leaders.json | 392 | ||||
| -rw-r--r-- | stats/pwc-summary-1-30.json | 42 | ||||
| -rw-r--r-- | stats/pwc-summary-121-150.json | 96 | ||||
| -rw-r--r-- | stats/pwc-summary-151-180.json | 124 | ||||
| -rw-r--r-- | stats/pwc-summary-181-210.json | 110 | ||||
| -rw-r--r-- | stats/pwc-summary-211-240.json | 106 | ||||
| -rw-r--r-- | stats/pwc-summary-241-270.json | 38 | ||||
| -rw-r--r-- | stats/pwc-summary-31-60.json | 108 | ||||
| -rw-r--r-- | stats/pwc-summary-61-90.json | 26 | ||||
| -rw-r--r-- | stats/pwc-summary-91-120.json | 106 | ||||
| -rw-r--r-- | stats/pwc-summary.json | 48 |
20 files changed, 1372 insertions, 1163 deletions
diff --git a/challenge-153/robert-dicicco/perl/ch-1.pl b/challenge-153/robert-dicicco/perl/ch-1.pl new file mode 100644 index 0000000000..8a9a69c4b6 --- /dev/null +++ b/challenge-153/robert-dicicco/perl/ch-1.pl @@ -0,0 +1,23 @@ +#!perl.exe + +use strict; +use warnings; +use ntheory qw/factorial/; + +# Author: Robert DiCicco +# Date: 21-FEB-2022 +# Challenge #153 Left Factorials ( Perl ) + +my $prevval = 0; + +print 'Left Factorials: '; + +foreach(0..9){ + my $val = factorial($_); + + $prevval += $val; + + print "$prevval "; +} + +print "\n"; diff --git a/challenge-153/robert-dicicco/perl/ch-2.pl b/challenge-153/robert-dicicco/perl/ch-2.pl new file mode 100644 index 0000000000..f9671bfb91 --- /dev/null +++ b/challenge-153/robert-dicicco/perl/ch-2.pl @@ -0,0 +1,41 @@ +#!perl.exe + +use strict; +use warnings; +use Carp; +use ntheory qw/factorial/; + +# Author: Robert DiCicco +# Date: 21-FEB-2022 +# Challenge #153 Factorions ( Perl ) + +my $num = $ARGV[0]; +if ( not defined $num ){ + croak "No number supplied "; +} + +chomp($num); + +my $sumdigits = 0; +my $outstr = q{}; + +print "Input \$n = $num\n"; + +my $ret = is_factorion($num); +chop $outstr for 1..2; + +print "$outstr = $sumdigits\n"; +print "Output: $ret\n"; + +sub is_factorion { + my $n = shift; + my @digits = split(//,$n); + foreach my $x (@digits){ + + $outstr .= "$x\! + "; + $sumdigits += factorial($x); + + } + + ($sumdigits == $n) ? 1 : 0; +} diff --git a/challenge-153/robert-dicicco/raku/ch-1.raku b/challenge-153/robert-dicicco/raku/ch-1.raku new file mode 100644 index 0000000000..87c25c51b1 --- /dev/null +++ b/challenge-153/robert-dicicco/raku/ch-1.raku @@ -0,0 +1,24 @@ +use v6; + +# Author: Robert DiCicco +# Date: 21-FEB-2022 +# Challenge #153 Left Factorial ( Raku ) + +multi sub factorial(Int $x where {$x < 2}) { + return 1; +} + +multi sub factorial(Int $x where {$x >= 2}) { + return $x * factorial($x - 1); +} + +my $prevval = 0; +print 'Left Factorials: '; + +for 0..9 -> $i { + my $val = factorial($i); + $prevval += $val; + print "$prevval "; +} + +print "\n"; diff --git a/challenge-153/robert-dicicco/raku/ch-2.raku b/challenge-153/robert-dicicco/raku/ch-2.raku new file mode 100644 index 0000000000..5946eadf0a --- /dev/null +++ b/challenge-153/robert-dicicco/raku/ch-2.raku @@ -0,0 +1,36 @@ +use v6; + +# Author: Robert DiCicco +# Date: 21-FEB-2022 +# Challenge #153 Factorions ( Raku ) + +multi sub factorial($x where {$x < 2}) { + return 1; +} + +multi sub factorial($x where {$x >= 2}) { + return $x * factorial($x - 1); +} + +sub is_factorion(Int $n) { + my $outstr = q{}; + my $sumdigits = 0; + my @digits = $n.comb; + + for @digits -> $item { + $outstr ~= "$item\! + "; + $sumdigits += factorial($item); + } + + print "$outstr.chop(3)" ~ " = $sumdigits\n"; + + ($sumdigits == $n) ?? 1 !! 0; +} + +sub MAIN(Int $num) { + print "Input \$n = $num\n"; + + my $ret = is_factorion($num); + + print "Output: $ret\n"; +} diff --git a/challenge-153/robert-dicicco/ruby/ch-1.rb b/challenge-153/robert-dicicco/ruby/ch-1.rb new file mode 100644 index 0000000000..a29b7dab03 --- /dev/null +++ b/challenge-153/robert-dicicco/ruby/ch-1.rb @@ -0,0 +1,27 @@ +#!ruby.exe + +# Author: Robert DiCicco +# Date: 21-FEB-2022 +# Challenge #153 Left Factorials ( Ruby ) + +class Integer + def fact + (1..self).reduce(:*) || 1 + end +end + +prevval = 0 + +print "Left Factorials: " + +(0..9).each do |e| + + val = e.fact + + prevval = prevval + val + + print prevval.to_s + " " + +end + +puts diff --git a/challenge-153/robert-dicicco/ruby/ch-2.rb b/challenge-153/robert-dicicco/ruby/ch-2.rb new file mode 100644 index 0000000000..c89f728fb4 --- /dev/null +++ b/challenge-153/robert-dicicco/ruby/ch-2.rb @@ -0,0 +1,39 @@ +#!ruby.exe + +# Author: Robert DiCicco +# Date: 21-FEB-2022 +# Challenge #153 Factorion (Ruby) + +class Integer + def fact + (1..self).reduce(:*) || 1 + end +end + +def is_factorion?(n) + numarr = n.digits.reverse + factorion = 0 + outstr = '' + numarr.each { |e| + factorion = factorion + e.fact + outstr = outstr + e.fact.to_s + "! + " + } + + (n == factorion) ? [1, factorion, outstr] : [0,factorion, outstr] +end + +num = ARGV[0]; +if ARGV.length == 0 + puts 'No number supplied' + exit +end + +sumdigits = 0 + +puts "Input $n = " + num + +retval, f, o = is_factorion?(num.to_i) + +puts o.chomp!(" + ") + " = " + f.to_s + +puts "Output: " + retval.to_s diff --git a/stats/pwc-current.json b/stats/pwc-current.json index 93c94d33cc..04b6d7c879 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -1,10 +1,27 @@ { + "xAxis" : { + "type" : "category" + }, + "plotOptions" : { + "series" : { + "borderWidth" : 0, + "dataLabels" : { + "format" : "{point.y}", + "enabled" : 1 + } + } + }, "legend" : { "enabled" : 0 }, "chart" : { "type" : "column" }, + "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 + }, "drilldown" : { "series" : [ { @@ -18,17 +35,16 @@ "id" : "Abigail" }, { + "name" : "E. Choroba", "id" : "E. Choroba", "data" : [ [ "Perl", 2 ] - ], - "name" : "E. Choroba" + ] }, { - "name" : "Luca Ferrari", "data" : [ [ "Raku", @@ -39,17 +55,18 @@ 2 ] ], - "id" : "Luca Ferrari" + "id" : "Luca Ferrari", + "name" : "Luca Ferrari" }, { + "name" : "Mark Anderson", + "id" : "Mark Anderson", "data" : [ [ "Raku", 2 ] - ], - "id" : "Mark Anderson", - "name" : "Mark Anderson" + ] }, { "id" : "Marton Polgar", @@ -62,7 +79,6 @@ "name" : "Marton Polgar" }, { - "name" : "Peter Campbell Smith", "id" : "Peter Campbell Smith", "data" : [ [ @@ -73,17 +89,18 @@ "Blog", 1 ] - ] + ], + "name" : "Peter Campbell Smith" }, { - "name" : "PokGoPun", + "id" : "PokGoPun", "data" : [ [ "Perl", 2 ] ], - "id" : "PokGoPun" + "name" : "PokGoPun" }, { "data" : [ @@ -96,11 +113,24 @@ 2 ] ], + "id" : "Robert DiCicco", + "name" : "Robert DiCicco" + }, + { "id" : "Roger Bell_West", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ] + ], "name" : "Roger Bell_West" }, { - "id" : "W. Luis Mochan", "data" : [ [ "Perl", @@ -111,89 +141,78 @@ 1 ] ], + "id" : "W. Luis Mochan", "name" : "W. Luis Mochan" } ] }, - "tooltip" : { - "followPointer" : 1, - "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/>" - }, "title" : { "text" : "The Weekly Challenge - 153" }, - "xAxis" : { - "type" : "category" - }, "yAxis" : { "title" : { "text" : "Total Solutions" } }, - "subtitle" : { - "text" : "[Champions: 9] Last updated at 2022-02-21 19:53:37 GMT" - }, - "plotOptions" : { - "series" : { - "borderWidth" : 0, - "dataLabels" : { - "enabled" : 1, - "format" : "{point.y}" - } - } - }, "series" : [ { "data" : [ { + "name" : "Abigail", "drilldown" : "Abigail", - "y" : 2, - "name" : "Abigail" + "y" : 2 }, { - "y" : 2, "name" : "E. Choroba", + "y" : 2, "drilldown" : "E. Choroba" }, { "name" : "Luca Ferrari", - "y" : 4, - "drilldown" : "Luca Ferrari" + "drilldown" : "Luca Ferrari", + "y" : 4 }, { + "name" : "Mark Anderson", "drilldown" : "Mark Anderson", - "y" : 2, - "name" : "Mark Anderson" + "y" : 2 }, { + "name" : "Marton Polgar", "drilldown" : "Marton Polgar", - "y" : 2, - "name" : "Marton Polgar" + "y" : 2 }, { + "y" : 3, "drilldown" : "Peter Campbell Smith", - "name" : "Peter Campbell Smith", - "y" : 3 + "name" : "Peter Campbell Smith" }, { "drilldown" : "PokGoPun", - "name" : "PokGoPun", - "y" : 2 + "y" : 2, + "name" : "PokGoPun" }, { "y" : 4, + "drilldown" : "Robert DiCicco", + "name" : "Robert DiCicco" + }, + { "name" : "Roger Bell_West", + "y" : 4, "drilldown" : "Roger Bell_West" }, { + "name" : "W. Luis Mochan", "drilldown" : "W. Luis Mochan", - "y" : 3, - "name" : "W. Luis Mochan" + "y" : 3 } ], "colorByPoint" : 1, "name" : "The Weekly Challenge - 153" } - ] + ], + "subtitle" : { + "text" : "[Champions: 10] Last updated at 2022-02-21 20:09:15 GMT" + } } diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json index 9e0901f142..f0c6a3b5c9 100644 --- a/stats/pwc-language-breakdown-summary.json +++ b/stats/pwc-language-breakdown-summary.json @@ -1,12 +1,24 @@ { - "yAxis" : { - "min" : 0, - "title" : { - "text" : null + "xAxis" : { + "type" : "category", + "labels" : { + "style" : { + "fontSize" : "13px", + "fontFamily" : "Verdana, sans-serif" + } } }, + "tooltip" : { + "pointFormat" : "<b>{point.y:.0f}</b>" + }, "subtitle" : { - "text" : "Last updated at 2022-02-21 19:53:37 GMT" + "text" : "Last updated at 2022-02-21 20:09:15 GMT" + }, + "chart" : { + "type" : "column" + }, + "legend" : { + "enabled" : "false" }, "series" : [ { @@ -17,47 +29,35 @@ ], [ "Perl", - 7338 + 7340 ], [ "Raku", - 4409 + 4411 ] ], "dataLabels" : { - "align" : "right", - "rotation" : -90, "color" : "#FFFFFF", - "format" : "{point.y:.0f}", "y" : 10, - "enabled" : "true", + "align" : "right", "style" : { "fontFamily" : "Verdana, sans-serif", "fontSize" : "13px" - } + }, + "format" : "{point.y:.0f}", + "enabled" : "true", + "rotation" : -90 }, "name" : "Contributions" } ], - "legend" : { - "enabled" : "false" - }, - "chart" : { - "type" : "column" + "yAxis" : { + "title" : { + "text" : null + }, + "min" : 0 }, "title" : { "text" : "The Weekly Challenge Contributions [2019 - 2022]" - }, - "xAxis" : { - "labels" : { - "style" : { - "fontFamily" : "Verdana, sans-serif", - "fontSize" : "13px" - } - }, - "type" : "category" - }, - "tooltip" : { - "pointFormat" : "<b>{point.y:.0f}</b>" } } diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json index 515d2838a8..7186ee5c0b 100644 --- a/stats/pwc-language-breakdown.json +++ b/stats/pwc-language-breakdown.json @@ -1,19 +1,7 @@ { - "tooltip" : { - "headerFormat" : "<span style=\"font-size:11px\"></span>", - "followPointer" : "true", - "pointFormat" : "<span style=\"color:{point.color}\">Challenge {point.name}</span>: <b>{point.y:f}</b><br/>" - }, - "xAxis" : { - "type" : "category" - }, - "title" : { - "text" : "The Weekly Challenge Language" - }, "drilldown" : { "series" : [ { - "name" : "001", "data" : [ [ "Perl", @@ -28,10 +16,11 @@ 11 ] ], - "id" : "001" + "id" : "001", + "name" : "001" }, { - "name" : "002", + "id" : "002", "data" : [ [ "Perl", @@ -46,10 +35,9 @@ 10 ] ], - "id" : "002" + "name" : "002" }, { - "name" : "003", "id" : "003", "data" : [ [ @@ -64,7 +52,8 @@ "Blog", 9 ] - ] + ], + "name" : "003" }, { "data" : [ @@ -86,7 +75,6 @@ }, { "name" : "005", - "id" : "005", "data" : [ [ "Perl", @@ -100,11 +88,10 @@ "Blog", 12 ] - ] + ], + "id" : "005" }, { - "name" : "006", - "id" : "006", "data" : [ [ "Perl", @@ -118,10 +105,12 @@ "Blog", 7 ] - ] + ], + "id" : "006", + "name" : "006" }, { - "name" : "007", + "id" : "007", "data" : [ [ "Perl", @@ -136,10 +125,9 @@ 10 ] ], - "id" : "007" + "name" : "007" }, { - "name" : "008", "id" : "008", "data" : [ [ @@ -154,7 +142,8 @@ "Blog", 12 ] - ] + ], + "name" : "008" }, { "name" : "009", @@ -175,7 +164,7 @@ ] }, { - "id" : "010", + "name" : "010", "data" : [ [ "Perl", @@ -190,10 +179,9 @@ 11 ] ], - "name" : "010" + "id" : "010" }, { - "name" : "011", "data" : [ [ "Perl", @@ -208,11 +196,11 @@ 10 ] ], - "id" : "011" + "id" : "011", + "name" : "011" }, { "name" : "012", - "id" : "012", "data" : [ [ "Perl", @@ -226,9 +214,11 @@ "Blog", 11 ] - ] + ], + "id" : "012" }, { + "name" : "013", "data" : [ [ "Perl", @@ -243,8 +233,7 @@ 13 ] ], - "id" : "013", - "name" : "013" + "id" : "013" }, { "data" : [ @@ -265,7 +254,6 @@ "name" : "014" }, { - "id" : "015", "data" : [ [ "Perl", @@ -280,11 +268,11 @@ 15 ] ], + "id" : "015", "name" : "015" }, { "name" : "016", - "id" : "016", "data" : [ [ "Perl", @@ -298,7 +286,8 @@ "Blog", 12 ] - ] + ], + "id" : "016" }, { "name" : "017", @@ -320,7 +309,6 @@ }, { "name" : "018", - "id" : "018", "data" : [ [ "Perl", @@ -334,11 +322,11 @@ "Blog", 14 ] - ] + ], + "id" : "018" }, { "name" : "019", - "id" : "019", "data" : [ [ "Perl", @@ -352,10 +340,11 @@ "Blog", 13 ] - ] + ], + "id" : "019" }, { - "name" : "020", + "id" : "020", "data" : [ [ "Perl", @@ -370,7 +359,7 @@ 13 ] ], - "id" : "020" + "name" : "020" }, { "id" : "021", @@ -391,7 +380,7 @@ "name" : "021" }, { - "name" : "022", + "id" : "022", "data" : [ [ "Perl", @@ -406,11 +395,9 @@ 10 ] ], - "id" : "022" + "name" : "022" }, { - "name" : "023", - "id" : "023", "data" : [ [ "Perl", @@ -424,10 +411,12 @@ "Blog", 12 ] - ] + ], + "id" : "023", + "name" : "023" }, { - "id" : "024", + "name" : "024", "data" : [ [ "Perl", @@ -442,7 +431,7 @@ 11 ] ], - "name" : "024" + "id" : "024" }, { "name" : "025", @@ -499,8 +488,6 @@ ] }, { - "name" : "028", - "id" : "028", "data" : [ [ "Perl", @@ -514,10 +501,11 @@ "Blog", 9 ] - ] + ], + "id" : "028", + "name" : "028" }, { - "name" : "029", "id" : "029", "data" : [ [ @@ -532,10 +520,12 @@ "Blog", 12 ] - ] + ], + "name" : "029" }, { "name" : "030", + "id" : "030", "data" : [ [ "Perl", @@ -549,8 +539,7 @@ "Blog", 10 ] - ], - "id" : "030" + ] }, { "name" : "031", @@ -571,6 +560,7 @@ "id" : "031" }, { + "id" : "032", "data" : [ [ "Perl", @@ -585,11 +575,9 @@ 10 ] ], - "id" : "032", "name" : "032" }, { - "id" : "033", "data" : [ [ "Perl", @@ -604,9 +592,11 @@ 10 ] ], + "id" : "033", "name" : "033" }, { + "name" : "034", "id" : "034", "data" : [ [ @@ -621,8 +611,7 @@ "Blog", 11 ] - ], - "name" : "034" + ] }, { "data" : [ @@ -643,6 +632,7 @@ "name" : "035" }, { + "name" : "036", "data" : [ [ "Perl", @@ -657,11 +647,9 @@ 11 ] ], - "id" : "036", - "name" : "036" + "id" : "036" }, { - "id" : "037", "data" : [ [ "Perl", @@ -676,11 +664,10 @@ 9 ] ], + "id" : "037", "name" : "037" }, { - "name" : "038", - "id" : "038", "data" : [ [ "Perl", @@ -694,7 +681,9 @@ "Blog", 12 ] - ] + ], + "id" : "038", + "name" : "038" }, { "id" : "039", @@ -769,6 +758,8 @@ "name" : "042" }, { + "name" : "043", + "id" : "043", "data" : [ [ "Perl", @@ -782,13 +773,9 @@ "Blog", 11 ] - ], - "id" : "043", - "name" : "043" + ] }, { - "name" : "044", - "id" : "044", "data" : [ [ "Perl", @@ -802,10 +789,11 @@ "Blog", 11 ] - ] + ], + "id" : "044", + "name" : "044" }, { - "name" : "045", "id" : "045", "data" : [ [ @@ -820,10 +808,12 @@ "Blog", 11 ] - ] + ], + "name" : "045" }, { "name" : "046", + "id" : "046", "data" : [ [ "Perl", @@ -837,11 +827,9 @@ "Blog", 10 ] - ], - "id" : "046" + ] }, { - "name" : "047", "id" : "047", "data" : [ [ @@ -856,9 +844,11 @@ "Blog", 10 ] - ] + ], + "name" : "047" }, { + "id" : "048", "data" : [ [ "Perl", @@ -873,11 +863,10 @@ 12 ] ], - "id" : "048", "name" : "048" }, { - "name" : "049", + "id" : "049", "data" : [ [ "Perl", @@ -892,10 +881,9 @@ 12 ] ], - "id" : "049" + "name" : "049" }, { - "id" : "050", "data" : [ [ "Perl", @@ -910,10 +898,11 @@ 12 ] ], |
