diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2022-06-07 18:13:36 +0100 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2022-06-07 18:13:36 +0100 |
| commit | ac32e51ae34212cd68b2cfdd8f72f54681006e29 (patch) | |
| tree | 1b07024ca5f16dedf39136e39d7188bf8877b4e6 | |
| parent | 541cbe1b04d5e804d2cabe879317cff9ae3f5cb4 (diff) | |
| download | perlweeklychallenge-club-ac32e51ae34212cd68b2cfdd8f72f54681006e29.tar.gz perlweeklychallenge-club-ac32e51ae34212cd68b2cfdd8f72f54681006e29.tar.bz2 perlweeklychallenge-club-ac32e51ae34212cd68b2cfdd8f72f54681006e29.zip | |
- Added solutions by Robert DiCicco.
| -rw-r--r-- | challenge-168/robert-dicicco/julia/ch-1.jl | 37 | ||||
| -rw-r--r-- | challenge-168/robert-dicicco/perl/ch-1.pl | 47 | ||||
| -rw-r--r-- | challenge-168/robert-dicicco/perl/ch-2.pl | 51 | ||||
| -rw-r--r-- | challenge-168/robert-dicicco/raku/ch-1.raku | 41 | ||||
| -rw-r--r-- | challenge-168/robert-dicicco/raku/ch-2.raku | 51 | ||||
| -rw-r--r-- | challenge-168/robert-dicicco/ruby/ch-1.rb | 37 | ||||
| -rw-r--r-- | stats/pwc-current.json | 115 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown-summary.json | 60 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown.json | 2360 | ||||
| -rw-r--r-- | stats/pwc-leaders.json | 402 | ||||
| -rw-r--r-- | stats/pwc-summary-1-30.json | 116 | ||||
| -rw-r--r-- | stats/pwc-summary-121-150.json | 30 | ||||
| -rw-r--r-- | stats/pwc-summary-151-180.json | 38 | ||||
| -rw-r--r-- | stats/pwc-summary-181-210.json | 42 | ||||
| -rw-r--r-- | stats/pwc-summary-211-240.json | 46 | ||||
| -rw-r--r-- | stats/pwc-summary-241-270.json | 46 | ||||
| -rw-r--r-- | stats/pwc-summary-31-60.json | 36 | ||||
| -rw-r--r-- | stats/pwc-summary-61-90.json | 108 | ||||
| -rw-r--r-- | stats/pwc-summary-91-120.json | 110 | ||||
| -rw-r--r-- | stats/pwc-summary.json | 40 |
20 files changed, 2048 insertions, 1765 deletions
diff --git a/challenge-168/robert-dicicco/julia/ch-1.jl b/challenge-168/robert-dicicco/julia/ch-1.jl new file mode 100644 index 0000000000..45d1bbcd64 --- /dev/null +++ b/challenge-168/robert-dicicco/julia/ch-1.jl @@ -0,0 +1,37 @@ +#!julia.exe + +# AUTHOR: Robert DiCicco +# DATE: 2022-06-06 +# Challenge 168 Perrin Primes ( Julia ) + +using Primes + +perrin = [3,0,2] + +results = [] + +PRIME_COUNT = 13 + +i = 0 + +while i <= PRIME_COUNT + + slots = size(perrin,1) + + calc_val = perrin[slots - 1] + perrin[slots - 2] # since julia arrays are option base 1 + + push!(perrin,calc_val) + + if isprime(calc_val) + + push!(results,calc_val) + + global i += 1 + + end + +end + +results = unique!(sort(results)) + +println(results) diff --git a/challenge-168/robert-dicicco/perl/ch-1.pl b/challenge-168/robert-dicicco/perl/ch-1.pl new file mode 100644 index 0000000000..b72ac33280 --- /dev/null +++ b/challenge-168/robert-dicicco/perl/ch-1.pl @@ -0,0 +1,47 @@ +#!perl.exe + +# AUTHOR: Robert DiCicco +# DATE: 2022-06-06 +# Challenge 168 Perrin Primes ( Perl ) + +use strict; +use warnings; +use feature qw/say/; +use ntheory qw/is_prime/; +use List::MoreUtils qw(uniq); + +my @perrin = qw(3 0 2 ); # working array + +my @results = (); + +my $i = 0; + +my $PRIME_COUNT = 13; + +while($i <= $PRIME_COUNT) { + + my $slots = scalar(@perrin); + + my $calc_val = $perrin[$slots - 2] + $perrin[$slots - 3]; + + push(@perrin, $calc_val); + + if (is_prime($calc_val)) { + + push(@results, $calc_val); + + $i++; + + } + +} + +@results = sort { $a <=> $b } uniq(@results); + +foreach(@results) { + + print("$_ "); + +} + +print("\n"); diff --git a/challenge-168/robert-dicicco/perl/ch-2.pl b/challenge-168/robert-dicicco/perl/ch-2.pl new file mode 100644 index 0000000000..8ecf170a47 --- /dev/null +++ b/challenge-168/robert-dicicco/perl/ch-2.pl @@ -0,0 +1,51 @@ +#!perl.exe + +# AUTHOR: Robert DiCicco +# DATE: 2022-06-06 +# Challenge 168 Home Prime ( Perl ) + +use strict; +use warnings; +use ntheory qw/is_prime factor divisors/; + +my $hp = 8; +my @results; + +sub homeprime { + my $hp = shift; + + my @factors = factor($hp); + + my $hp_new = join('',@factors); + + return($hp_new); + +} + +my $flag = 1; + +push(@results, $hp); + +while ( $flag > 0) { + + my $retval = homeprime($hp); + + if ( is_prime($retval) ){ + + push(@results, $retval); + + $flag = 0; + + } else { + + push(@results, $retval); + + $hp = $retval; + + } + +} + + print ("@results "); + + print("\n"); diff --git a/challenge-168/robert-dicicco/raku/ch-1.raku b/challenge-168/robert-dicicco/raku/ch-1.raku new file mode 100644 index 0000000000..acfda4039c --- /dev/null +++ b/challenge-168/robert-dicicco/raku/ch-1.raku @@ -0,0 +1,41 @@ +use v6; + +# AUTHOR: Robert DiCicco +# DATE: 2022-06-06 +# Challenge 168 Perrin Primes ( Raku ) + +my @perrin = (3,0,2); + +my @results = (); + +my $PRIME_COUNT = 13; + +my $i = 0; + +while $i <= $PRIME_COUNT { + + my $slots = @perrin.elems; + + my $calc_val = @perrin[$slots - 2] + @perrin[$slots - 3]; + + @perrin.push: $calc_val; + + if $calc_val.is-prime { + + @results.push: $calc_val; + + $i++; + + } + +} + +@results = @results.sort.unique; + +for @results -> $val { + + print "$val "; + +} + +say ' '; diff --git a/challenge-168/robert-dicicco/raku/ch-2.raku b/challenge-168/robert-dicicco/raku/ch-2.raku new file mode 100644 index 0000000000..1db7b563b2 --- /dev/null +++ b/challenge-168/robert-dicicco/raku/ch-2.raku @@ -0,0 +1,51 @@ +use v6; + +# AUTHOR: Robert DiCicco +# DATE: 2022-06-06 +# Challenge 168 Home Primes ( Raku ) + +use Prime::Factor; + +my @results; + +sub homeprime( $hp) { + + my @factors = prime-factors($hp); + + return(@factors.join); + +} + +my $hp = 8; + +my $flag = 1; + +@results.push: $hp; + +while $flag > 0 { + + my $retval = homeprime($hp); + + if $retval.is-prime { + + @results.push: $retval; + + $flag = 0; + + } else { + + @results.push: $retval; + + $hp = $retval; + + } + +} + +for @results -> $val { + + print "$val "; + +} + +say ' '; diff --git a/challenge-168/robert-dicicco/ruby/ch-1.rb b/challenge-168/robert-dicicco/ruby/ch-1.rb new file mode 100644 index 0000000000..0a050d6120 --- /dev/null +++ b/challenge-168/robert-dicicco/ruby/ch-1.rb @@ -0,0 +1,37 @@ +#!ruby.exe + +# AUTHOR: Robert DiCicco +# DATE: 2022-06-06 +# Challenge 168 Perrin Primes ( Ruby ) + +require 'prime' + +perrin = Array[3,0,2] + +PRIME_COUNT = 14 + +results = Array.new() + +i = 0 + +while i < PRIME_COUNT + + slots = perrin.length() + + calc_val = perrin[slots - 2] + perrin[slots - 3] + + perrin.push(calc_val) + + if Prime.prime?(calc_val) + + results.push(calc_val) + + i += 1 + + end + +end + +results = results.sort.uniq + +puts "#{results }" diff --git a/stats/pwc-current.json b/stats/pwc-current.json index d15e68523c..36a2059226 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -1,70 +1,78 @@ { - "title" : { - "text" : "The Weekly Challenge - 168" + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } }, "series" : [ { "data" : [ { - "name" : "James Smith", "y" : 3, - "drilldown" : "James Smith" + "drilldown" : "James Smith", + "name" : "James Smith" }, { + "drilldown" : "Luca Ferrari", "name" : "Luca Ferrari", - "y" : 8, - "drilldown" : "Luca Ferrari" + "y" : 8 }, { + "drilldown" : "Mark Anderson", "name" : "Mark Anderson", - "y" : 2, - "drilldown" : "Mark Anderson" + "y" : 2 }, { "y" : 2, - "drilldown" : "Marton Polgar", - "name" : "Marton Polgar" + "name" : "Marton Polgar", + "drilldown" : "Marton Polgar" }, { - "name" : "Peter Campbell Smith", "y" : 3, + "name" : "Peter Campbell Smith", "drilldown" : "Peter Campbell Smith" }, { "y" : 4, + "drilldown" : "Robert DiCicco", + "name" : "Robert DiCicco" + }, + { + "name" : "Roger Bell_West", "drilldown" : "Roger Bell_West", - "name" : "Roger Bell_West" + "y" : 4 }, { - "name" : "Ryan Thompson", "drilldown" : "Ryan Thompson", + "name" : "Ryan Thompson", "y" : 6 }, { + "drilldown" : "Stephen G Lynn", "name" : "Stephen G Lynn", - "y" : 2, - "drilldown" : "Stephen G Lynn" + "y" : 2 }, { - "name" : "W. Luis Mochan", "drilldown" : "W. Luis Mochan", + "name" : "W. Luis Mochan", "y" : 3 } ], - "name" : "The Weekly Challenge - 168", - "colorByPoint" : 1 + "colorByPoint" : 1, + "name" : "The Weekly Challenge - 168" } ], - "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 }, "subtitle" : { - "text" : "[Champions: 9] Last updated at 2022-06-07 15:15:08 GMT" + "text" : "[Champions: 10] Last updated at 2022-06-07 17:05:44 GMT" }, "drilldown" : { "series" : [ { - "id" : "James Smith", "data" : [ [ "Perl", @@ -75,10 +83,12 @@ 1 ] ], + "id" : "James Smith", "name" : "James Smith" }, { "name" : "Luca Ferrari", + "id" : "Luca Ferrari", "data" : [ [ "Raku", @@ -88,18 +98,17 @@ "Blog", 6 ] - ], - "id" : "Luca Ferrari" + ] }, { "name" : "Mark Anderson", + "id" : "Mark Anderson", "data" : [ [ "Raku", 2 ] - ], - "id" : "Mark Anderson" + ] }, { "data" : [ @@ -108,11 +117,10 @@ 2 ] ], - "id" : "Marton Polgar", - "name" : "Marton Polgar" + "name" : "Marton Polgar", + "id" : "Marton Polgar" }, { - "id" : "Peter Campbell Smith", "data" : [ [ "Perl", @@ -123,10 +131,10 @@ 1 ] ], + "id" : "Peter Campbell Smith", "name" : "Peter Campbell Smith" }, { - "id" : "Roger Bell_West", "data" : [ [ "Perl", @@ -137,7 +145,22 @@ 2 ] ], - "name" : "Roger Bell_West" + "id" : "Robert DiCicco", + "name" : "Robert DiCicco" + }, + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ] + ], + "name" : "Roger Bell_West", + "id" : "Roger Bell_West" }, { "name" : "Ryan Thompson", @@ -172,6 +195,8 @@ "name" : "Stephen G Lynn" }, { + "id" : "W. Luis Mochan", + "name" : "W. Luis Mochan", "data" : [ [ "Perl", @@ -181,35 +206,29 @@ "Blog", 1 ] - ], - "id" : "W. Luis Mochan", - "name" : "W. Luis Mochan" + ] } ] }, - "yAxis" : { - "title" : { - "text" : "Total Solutions" - } + "title" : { + "text" : "The Weekly Challenge - 168" + }, + "legend" : { + "enabled" : 0 }, "chart" : { "type" : "column" }, - "xAxis" : { - "type" : "category" - }, - "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/>" - }, "plotOptions" : { "series" : { - "borderWidth" : 0, "dataLabels" : { "format" : "{point.y}", "enabled" : 1 - } + }, + "borderWidth" : 0 } + }, + "xAxis" : { + "type" : "category" } } diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json index 0f2425b3bf..41b3d55d08 100644 --- a/stats/pwc-language-breakdown-summary.json +++ b/stats/pwc-language-breakdown-summary.json @@ -1,21 +1,24 @@ { - "yAxis" : { - "min" : 0, - "title" : { - "text" : null - } + "title" : { + "text" : "The Weekly Challenge Contributions [2019 - 2022]" }, "legend" : { "enabled" : "false" }, - "subtitle" : { - "text" : "Last updated at 2022-06-07 15:15:08 GMT" - }, - "title" : { - "text" : "The Weekly Challenge Contributions [2019 - 2022]" - }, "series" : [ { + "dataLabels" : { + "format" : "{point.y:.0f}", + "style" : { + "fontFamily" : "Verdana, sans-serif", + "fontSize" : "13px" + }, + "y" : 10, + "rotation" : -90, + "enabled" : "true", + "align" : "right", + "color" : "#FFFFFF" + }, "name" : "Contributions", "data" : [ [ @@ -24,40 +27,37 @@ ], [ "Perl", - 8165 + 8167 ], [ "Raku", - 4838 + 4840 ] - ], - "dataLabels" : { - "align" : "right", - "color" : "#FFFFFF", - "style" : { - "fontFamily" : "Verdana, sans-serif", - "fontSize" : "13px" - }, - "y" : 10, - "rotation" : -90, - "enabled" : "true", - "format" : "{point.y:.0f}" - } + ] } ], - "tooltip" : { - "pointFormat" : "<b>{point.y:.0f}</b>" + "yAxis" : { + "title" : { + "text" : null + }, + "min" : 0 }, "chart" : { "type" : "column" }, + "subtitle" : { + "text" : "Last updated at 2022-06-07 17:05:44 GMT" + }, + "tooltip" : { + "pointFormat" : "<b>{point.y:.0f}</b>" + }, "xAxis" : { + "type" : "category", "labels" : { "style" : { "fontFamily" : "Verdana, sans-serif", "fontSize" : "13px" } - }, - "type" : "category" + } } } diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json index 3912f0d13e..031b85ee81 100644 --- a/stats/pwc-language-breakdown.json +++ b/stats/pwc-language-breakdown.json @@ -1,869 +1,17 @@ { - "title" : { - "text" : "The Weekly Challenge Language" - }, - "series" : [ - { - "colorByPoint" : "true", - "name" : "The Weekly Challenge Languages", - "data" : [ - { - "drilldown" : "001", - "y" : 161, - "name" : "#001" - }, - { - "name" : "#002", - "y" : 125, - "drilldown" : "002" - }, - { - "drilldown" : "003", - "y" : 83, - "name" : "#003" - }, - { - "y" : 99, - "drilldown" : "004", - "name" : "#004" - }, - { - "name" : "#005", - "y" : 78, - "drilldown" : "005" - }, - { - "name" : "#006", - "y" : 58, - "drilldown" : "006" - }, - { - "drilldown" : "007", - "y" : 64, - "name" : "#007" - }, - { - "y" : 78, - "drilldown" : "008", - "name" : "#008" - }, - { - "name" : "#009", - "drilldown" : "009", - "y" : 76 - }, - { - "y" : 65, - "drilldown" : "010", - "name" : "#010" - }, - { - "name" : "#011", - "drilldown" : "011", - "y" : 85 - }, - { - "name" : "#012", - "drilldown" : "012", - "y" : 89 - }, - { - "name" : "#013", - "y" : 85, - "drilldown" : "013" - }, - { - "y" : 101, - "drilldown" : "014", - "name" : "#014" - }, - { - "y" : 99, - "drilldown" : "015", - "name" : "#015" - }, - { - "y" : 71, - "drilldown" : "016", - "name" : "#016" - }, - { - "drilldown" : "017", - "y" : 84, - "name" : "#017" - }, - { - "name" : "#018", - "y" : 81, - "drilldown" : "018" - }, - { - "y" : 103, - "drilldown" : "019", - "name" : "#019" - }, - { - "name" : "#020", - "y" : 101, - "drilldown" : "020" - }, - { - "y" : 72, - "drilldown" : "021", - "name" : "#021" - }, - { - "name" : "#022", - "y" : 68, - "drilldown" : "022" - }, - { - "y" : 97, - "drilldown" : "023", - "name" : "#023" - }, - { - "name" : "#024", - "y" : 75, - "drilldown" : "024" - }, - { - "drilldown" : "025", - "y" : 59, - "name" : "#025" - }, - { - "y" : 74, - "drilldown" : "026", - "name" : "#026" - }, - { - "y" : 62, - "drilldown" : "027", - "name" : "#027" - }, - { - "drilldown" : "028", - "y" : 82, - "name" : "#028" - }, - { - "y" : 81, - "drilldown" : "029", - "name" : "#029" - }, - { - "y" : 119, - "drilldown" : "030", - "name" : "#030" - }, - { - "y" : 91, - "drilldown" : "031", - "name" : "#031" - }, - { - "name" : "#032", - "drilldown" : "032", - "y" : 96 - }, - { - "drilldown" : "033", - "y" : 112, - "name" : "#033" - }, - { - "name" : "#034", - "y" : 66, - "drilldown" : "034" - }, - { - "drilldown" : "035", - "y" : 66, - "name" : "#035" - }, - { - "name" : "#036", - "y" : 70, - "drilldown" : "036" - }, - { - "y" : 69, - "drilldown" : "037", - "name" : "#037" - }, - { - "name" : "#038", - "drilldown" : "038", - "y" : 70 - }, - { - "drilldown" : "039", - "y" : 64, - "name" : "#039" - }, - { - "name" : "#040", - "drilldown" : "040", - "y" : 75 - }, - { - "name" : "#041", - "y" : 78, - "drilldown" : "041" - }, - { - "drilldown" : "042", - "y" : 94, - "name" : "#042" - }, - { - "drilldown" : "043", - "y" : 70, - "name" : "#043" - }, - { - "y" : 87, - "drilldown" : "044", - "name" : "#044" - }, - { - "y" : 98, - "drilldown" : "045", - "name" : "#045" - }, - { - "y" : 89, - "drilldown" : "046", - "name" : "#046" - }, - { - "drilldown" : "047", - "y" : 86, - "name" : "#047" - }, - { - "y" : 110, - "drilldown" : "048", - "name" : "#048" - }, - { - "y" : 91, - "drilldown" : "049", - "name" : "#049" - }, - { - "y" : 100, - "drilldown" : "050", - "name" : "#050" - }, - { - "y" : 91, - "drilldown" : "051", - "name" : "#051" - }, - { - "drilldown" : "052", - "y" : 93, - "name" : "#052" - }, - { - "y" : 103, - "drilldown" : "053", - "name" : "#053" - }, - { - "drilldown" : "054", - "y" : 105, - "name" : "#054" - }, - { - "name" : "#055", - "y" : 90, - "drilldown" : "055" - }, - { - "drilldown" : "056", - "y" : 97, - "name" : "#056" - }, - { - "name" : "#057", - "drilldown" : "057", - "y" : 82 - }, - { - "name" : "#058", - "y" : 71, - "drilldown" : "058" - }, - { - "drilldown" : "059", - "y" : 91, - "name" : "#059" - }, - { - "name" : "#060", - "drilldown" : "060", - "y" : 87 - }, - { - "name" : "#061", - "y" : 83, - "drilldown" : "061" - }, - { - "y" : 60, - "drilldown" : "062", - "name" : "#062" - }, - { - "y" : 91, - "drilldown" : "063", - "name" : "#063" - }, - { - "name" : "#064", - "y" : 82, - "drilldown" : "064" - }, - { - "name" : "#065", - "y" : 75, - "drilldown" : "065" - }, - { - "y" : 86, - "drilldown" : "066", - "name" : "#066" - }, - { - "y" : 92, - "drilldown" : "067", - "name" : "#067" - }, - { - "name" : "#068", - "drilldown" : "068", - "y" : 77 - }, - { - "name" : "#069", - "y" : 85, - "drilldown" : "069" - }, - { - "drilldown" : "070", - "y" : 95, - "name" : "#070" - }, - { - "name" : "#071", - "drilldown" : "071", - "y" : 80 - }, - { - "name" : "#072", - "drilldown" : "072", - "y" : 114 - }, - { - "drilldown" : "073", - "y" : 112, - "name" : "#073" - }, - { - "name" : "#074", - "y" : 117, - "drilldown" : "074" - }, - { - "name" : "#075", - "y" : 117, - "drilldown" : "075" - }, - { - "name" : "#076", - "y" : 101, - "drilldown" : "076" - }, - { - "y" : 100, - "drilldown" : "077", - "name" : "#077" - }, - { - "drilldown" : "078", - "y" : 127, - "name" : "#078" - }, - { - "drilldown" : "079", - "y" : 122, - "name" : "#079" - }, - { - "name" : "#080", - "drilldown" : "080", - "y" : 127 - }, - { - "name" : "#081", - "drilldown" : "081", - "y" : 114 - }, - { - "drilldown" : "082", - "y" : 114, - "name" : "#082" - }, - { - "name" : "#083", - "drilldown" : "083", - "y" : 127 - }, - { - "name" : "#084", - "y" : 119, - "drilldown" : "084" - }, - { - "name" : "#085", - "drilldown" : "085", - "y" : 114 - }, - { - "y" : 104, - "drilldown" : "086", - "name" : "#086" - }, - { - "y" : 101, |
