diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2021-10-10 17:17:18 +0100 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2021-10-10 17:17:18 +0100 |
| commit | a0d7e8d549e57b480ce2f27cd6df195475be4f89 (patch) | |
| tree | 5d6c9ab2f9bf31ea2193086c6dca13a6bee5d891 | |
| parent | 0fdcc6e6ed8a0b5565b6c966eb22b19550b21693 (diff) | |
| download | perlweeklychallenge-club-a0d7e8d549e57b480ce2f27cd6df195475be4f89.tar.gz perlweeklychallenge-club-a0d7e8d549e57b480ce2f27cd6df195475be4f89.tar.bz2 perlweeklychallenge-club-a0d7e8d549e57b480ce2f27cd6df195475be4f89.zip | |
- Added solutions by Pete Houston.
| -rwxr-xr-x | challenge-133/pete-houston/perl/ch-1.pl | 41 | ||||
| -rwxr-xr-x | challenge-133/pete-houston/perl/ch-2.pl | 44 | ||||
| -rw-r--r-- | stats/pwc-current.json | 437 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown-summary.json | 68 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown.json | 1788 | ||||
| -rw-r--r-- | stats/pwc-leaders.json | 736 | ||||
| -rw-r--r-- | stats/pwc-summary-1-30.json | 98 | ||||
| -rw-r--r-- | stats/pwc-summary-121-150.json | 88 | ||||
| -rw-r--r-- | stats/pwc-summary-151-180.json | 40 | ||||
| -rw-r--r-- | stats/pwc-summary-181-210.json | 46 | ||||
| -rw-r--r-- | stats/pwc-summary-211-240.json | 102 | ||||
| -rw-r--r-- | stats/pwc-summary-241-270.json | 24 | ||||
| -rw-r--r-- | stats/pwc-summary-31-60.json | 28 | ||||
| -rw-r--r-- | stats/pwc-summary-61-90.json | 112 | ||||
| -rw-r--r-- | stats/pwc-summary-91-120.json | 114 | ||||
| -rw-r--r-- | stats/pwc-summary.json | 524 |
16 files changed, 2195 insertions, 2095 deletions
diff --git a/challenge-133/pete-houston/perl/ch-1.pl b/challenge-133/pete-houston/perl/ch-1.pl new file mode 100755 index 0000000000..1d7ca9703f --- /dev/null +++ b/challenge-133/pete-houston/perl/ch-1.pl @@ -0,0 +1,41 @@ +#!/usr/bin/env perl +#=============================================================================== +# +# FILE: 13301.pl +# +# USAGE: ./13301.pl N [ N ... ] +# +# DESCRIPTION: Print the integer square root(s) of the argument(s) +# +# AUTHOR: Pete Houston (pete), cpan@openstrike.co.uk +# ORGANIZATION: Openstrike +# VERSION: 1.0 +# CREATED: 04/10/21 +#=============================================================================== + +use strict; +use warnings; + +while (my $sq = shift) { + next if $sq =~ /[^0-9]/; + print "Integer square root of $sq is " . isqrt ($sq) . "\n"; +} + +# Woo's Abacus method +sub isqrt { + use integer; + my $in = shift; + my $root = 0; + my $top = 1 << 30; + $top >>= 2 while $top > $in; + + while ($top) { + if ($in >= $root + $top) { + $in -= $root + $top; + $root += 2 * $top; + } + $root /= 2; + $top /= 4; + } + return $root; +} diff --git a/challenge-133/pete-houston/perl/ch-2.pl b/challenge-133/pete-houston/perl/ch-2.pl new file mode 100755 index 0000000000..eb21a4fe47 --- /dev/null +++ b/challenge-133/pete-houston/perl/ch-2.pl @@ -0,0 +1,44 @@ +#!/usr/bin/env perl +#=============================================================================== +# +# FILE: 13302.pl +# +# USAGE: ./13302.pl +# +# DESCRIPTION: Generate the first 10 Smith Numbers +# +# REQUIREMENTS: List::Util, Math::Prime::Util, Perl 5.10 or higher +# AUTHOR: Pete Houston (pete), cpan@openstrike.co.uk +# ORGANIZATION: Openstrike +# VERSION: 1.0 +# CREATED: 04/10/21 +#=============================================================================== + +use strict; +use warnings; +use List::Util 'sum'; +use Math::Prime::Util qw/is_prime factor/; + +my $n = 0; +my $i = 1; +while ($n < 10) { + if (smith ($i)) { + print "$i\n"; + $n++; + } + $i++; +} + +sub smith { + my $x = shift; + return 0 if is_prime ($x); + return dsum ($x) == dsum (prime_factors ($x)); +} + +sub dsum { + return sum split //, shift; +} + +sub prime_factors { + return join '', factor (shift); +} diff --git a/stats/pwc-current.json b/stats/pwc-current.json index a6404e3359..d27d94a089 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -1,186 +1,34 @@ { - "yAxis" : { - "title" : { - "text" : "Total Solutions" - } + "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/>" }, "subtitle" : { - "text" : "[Champions: 28] Last updated at 2021-10-10 16:09:13 GMT" + "text" : "[Champions: 29] Last updated at 2021-10-10 16:15:52 GMT" + }, + "title" : { + "text" : "The Weekly Challenge - 133" }, "legend" : { "enabled" : 0 }, + "chart" : { + "type" : "column" + }, "plotOptions" : { "series" : { - "borderWidth" : 0, "dataLabels" : { "format" : "{point.y}", "enabled" : 1 - } - } - }, - "series" : [ - { - "name" : "The Weekly Challenge - 133", - "data" : [ - { - "drilldown" : "Abigail", - "name" : "Abigail", - "y" : 4 - }, - { - "name" : "Andinus", - "drilldown" : "Andinus", - "y" : 2 - }, - { - "y" : 5, - "drilldown" : "Arne Sommer", - "name" : "Arne Sommer" - }, - { - "y" : 4, - "drilldown" : "Athanasius", - "name" : "Athanasius" - }, - { - "name" : "Ben Davies", - "drilldown" : "Ben Davies", - "y" : 2 - }, - { - "name" : "Cheok-Yin Fung", - "drilldown" : "Cheok-Yin Fung", - "y" : 1 - }, - { - "y" : 3, - "name" : "Dave Jacoby", - "drilldown" : "Dave Jacoby" - }, - { - "y" : 2, - "drilldown" : "E. Choroba", - "name" : "E. Choroba" - }, - { - "name" : "Flavio Poletti", - "drilldown" : "Flavio Poletti", - "y" : 6 - }, - { - "y" : 5, - "name" : "Ian Goodnight", - "drilldown" : "Ian Goodnight" - }, - { - "y" : 2, - "name" : "James Raspass", - "drilldown" : "James Raspass" - }, - { - "y" : 3, - "drilldown" : "James Smith", - "name" : "James Smith" - }, - { - "y" : 1, - "drilldown" : "Jan Krnavek", - "name" : "Jan Krnavek" - }, - { - "y" : 2, - "name" : "Jorg Sommrey", - "drilldown" : "Jorg Sommrey" - }, - { - "y" : 5, - "drilldown" : "Laurent Rosenfeld", - "name" : "Laurent Rosenfeld" - }, - { - "name" : "Lubos Kolouch", - "drilldown" : "Lubos Kolouch", - "y" : 1 - }, - { - "y" : 4, - "drilldown" : "Luca Ferrari", - "name" : "Luca Ferrari" - }, - { - "drilldown" : "Mark Anderson", - "name" : "Mark Anderson", - "y" : 2 - }, - { - "drilldown" : "Mohammad S Anwar", - "name" : "Mohammad S Anwar", - "y" : 1 - }, - { - "y" : 2, - "name" : "Peter Campbell Smith", - "drilldown" : "Peter Campbell Smith" - }, - { - "drilldown" : "Rage311", - "name" : "Rage311", - "y" : 1 - }, - { - "y" : 5, - "name" : "Roger Bell_West", - "drilldown" : "Roger Bell_West" - }, - { - "name" : "Simon Green", - "drilldown" : "Simon Green", - "y" : 3 - }, - { - "y" : 2, - "drilldown" : "Simon Proctor", - "name" : "Simon Proctor" - }, - { - "name" : "Steven Wilson", - "drilldown" : "Steven Wilson", - "y" : 1 - }, - { - "y" : 4, - "name" : "Ulrich Rieke", - "drilldown" : "Ulrich Rieke" - }, - { - "y" : 3, - "name" : "W. Luis Mochan", - "drilldown" : "W. Luis Mochan" - }, - { - "y" : 2, - "name" : "Wanderdoc", - "drilldown" : "Wanderdoc" - } - ], - "colorByPoint" : 1 + }, + "borderWidth" : 0 } - ], - "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 - }, - "title" : { - "text" : "The Weekly Challenge - 133" - }, - "xAxis" : { - "type" : "category" }, "drilldown" : { "series" : [ { + "name" : "Abigail", "data" : [ [ "Perl", @@ -191,11 +39,9 @@ 2 ] ], - "name" : "Abigail", "id" : "Abigail" }, { - "id" : "Andinus", "name" : "Andinus", "data" : [ [ @@ -206,10 +52,10 @@ "Blog", 1 ] - ] + ], + "id" : "Andinus" }, { - "id" : "Arne Sommer", "name" : "Arne Sommer", "data" : [ [ @@ -224,11 +70,10 @@ "Blog", 1 ] - ] + ], + "id" : "Arne Sommer" }, { - "id" : "Athanasius", - "name" : "Athanasius", "data" : [ [ "Perl", @@ -238,30 +83,31 @@ "Raku", 2 ] - ] + ], + "id" : "Athanasius", + "name" : "Athanasius" }, { - "name" : "Ben Davies", "data" : [ [ "Raku", 2 ] ], - "id" : "Ben Davies" + "id" : "Ben Davies", + "name" : "Ben Davies" }, { - "name" : "Cheok-Yin Fung", "data" : [ [ "Perl", 1 ] ], - "id" : "Cheok-Yin Fung" + "id" : "Cheok-Yin Fung", + "name" : "Cheok-Yin Fung" }, { - "name" : "Dave Jacoby", "data" : [ [ "Perl", @@ -272,20 +118,21 @@ 1 ] ], + "name" : "Dave Jacoby", "id" : "Dave Jacoby" }, { + "name" : "E. Choroba", "data" : [ [ "Perl", 2 ] ], - "name" : "E. Choroba", "id" : "E. Choroba" }, { - "name" : "Flavio Poletti", + "id" : "Flavio Poletti", "data" : [ [ "Perl", @@ -300,9 +147,10 @@ 2 ] ], - "id" : "Flavio Poletti" + "name" : "Flavio Poletti" }, { + "id" : "Ian Goodnight", "data" : [ [ "Perl", @@ -313,21 +161,19 @@ 3 ] ], - "name" : "Ian Goodnight", - "id" : "Ian Goodnight" + "name" : "Ian Goodnight" }, { - "id" : "James Raspass", "data" : [ [ "Raku", 2 ] ], + "id" : "James Raspass", "name" : "James Raspass" }, { - "id" : "James Smith", "data" : [ [ "Perl", @@ -338,7 +184,8 @@ 1 ] ], - "name" : "James Smith" + "name" : "James Smith", + "id" : "James Smith" }, { "id" : "Jan Krnavek", @@ -351,17 +198,16 @@ "name" : "Jan Krnavek" }, { - "id" : "Jorg Sommrey", "data" : [ [ "Perl", 2 ] ], + "id" : "Jorg Sommrey", "name" : "Jorg Sommrey" }, { - "name" : "Laurent Rosenfeld", "data" : [ [ "Perl", @@ -376,20 +222,20 @@ 1 ] ], - "id" : "Laurent Rosenfeld" + "id" : "Laurent Rosenfeld", + "name" : "Laurent Rosenfeld" }, { - "name" : "Lubos Kolouch", "data" : [ [ "Perl", 1 ] ], + "name" : "Lubos Kolouch", "id" : "Lubos Kolouch" }, { - "id" : "Luca Ferrari", "data" : [ [ "Raku", @@ -400,7 +246,8 @@ 2 ] ], - "name" : "Luca Ferrari" + "name" : "Luca Ferrari", + "id" : "Luca Ferrari" }, { "id" : "Mark Anderson", @@ -413,24 +260,34 @@ "name" : "Mark Anderson" }, { - "id" : "Mohammad S Anwar", "name" : "Mohammad S Anwar", "data" : [ [ "Perl", 1 ] - ] + ], + "id" : "Mohammad S Anwar" + }, + { + "name" : "Pete Houston", + "data" : [ + [ + "Perl", + 2 + ] + ], + "id" : "Pete Houston" }, { + "id" : "Peter Campbell Smith", "data" : [ [ "Perl", 2 ] ], - "name" : "Peter Campbell Smith", - "id" : "Peter Campbell Smith" + "name" : "Peter Campbell Smith" }, { "name" : "Rage311", @@ -443,8 +300,6 @@ "id" : "Rage311" }, { - "id" : "Roger Bell_West", - "name" : "Roger Bell_West", "data" : [ [ "Perl", @@ -458,10 +313,11 @@ "Blog", 1 ] - ] + ], + "name" : "Roger Bell_West", + "id" : "Roger Bell_West" }, { - "name" : "Simon Green", "data" : [ [ "Perl", @@ -472,17 +328,18 @@ 1 ] ], + "name" : "Simon Green", "id" : "Simon Green" }, { - "name" : "Simon Proctor", "data" : [ [ "Raku", 2 ] ], - "id" : "Simon Proctor" + "id" : "Simon Proctor", + "name" : "Simon Proctor" }, { "id" : "Steven Wilson", @@ -495,7 +352,6 @@ "name" : "Steven Wilson" }, { - "id" : "Ulrich Rieke", "data" : [ [ "Perl", @@ -506,10 +362,10 @@ 2 ] ], + "id" : "Ulrich Rieke", "name" : "Ulrich Rieke" }, { - "name" : "W. Luis Mochan", "data" : [ [ "Perl", @@ -520,21 +376,180 @@ 1 ] ], - "id" : "W. Luis Mochan" + "id" : "W. Luis Mochan", + "name" : "W. Luis Mochan" }, { "id" : "Wanderdoc", - "name" : "Wanderdoc", "data" : [ [ "Perl", 2 ] - ] + ], + "name" : "Wanderdoc" } ] }, - "chart" : { - "type" : "column" - } + "xAxis" : { + "type" : "category" + }, + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } + }, + "series" : [ + { + "colorByPoint" : 1, + "data" : [ + { + "drilldown" : "Abigail", + "y" : 4, + "name" : "Abigail" + }, + { + "name" : "Andinus", + "y" : 2, + "drilldown" : "Andinus" + }, + { + "drilldown" : "Arne Sommer", + "name" : "Arne Sommer", + "y" : 5 + }, + { + "y" : 4, + "name" : "Athanasius", + "drilldown" : "Athanasius" + }, + { + "drilldown" : "Ben Davies", + "y" : 2, + "name" : "Ben Davies" + }, + { + "drilldown" : "Cheok-Yin Fung", + "name" : "Cheok-Yin Fung", + "y" : 1 + }, + { + "name" : "Dave Jacoby", + "y" : 3, + "drilldown" : "Dave Jacoby" + }, + { + "name" : "E. Choroba", + "y" : 2, + "drilldown" : "E. Choroba" + }, + { + "name" : "Flavio Poletti", + "y" : 6, + "drilldown" : "Flavio Poletti" + }, + { + "drilldown" : "Ian Goodnight", + "name" : "Ian Goodnight", + "y" : 5 + }, + { + "drilldown" : "James Raspass", + "name" : "James Raspass", + "y" : 2 + }, + { + "drilldown" : "James Smith", + "y" : 3, + "name" : "James Smith" + }, + { + "name" : "Jan Krnavek", + "y" : 1, + "drilldown" : "Jan Krnavek" + }, + { + "drilldown" : "Jorg Sommrey", + "y" : 2, + "name" : "Jorg Sommrey" + }, + { + "drilldown" : "Laurent Rosenfeld", + "y" : 5, + "name" : "Laurent Rosenfeld" + }, + { + "drilldown" : "Lubos Kolouch", + "name" : "Lubos Kolouch", + "y" : 1 + }, + { + "name" : "Luca Ferrari", + "y" : 4, + "drilldown" : "Luca Ferrari" + }, + { + "drilldown" : "Mark Anderson", + "y" : 2, + "name" : "Mark Anderson" + }, + { + "drilldown" : "Mohammad S Anwar", + "y" : 1, + "name" : "Mohammad S Anwar" + }, + { + "y" : 2, + "name" : "Pete Houston", + "drilldown" : "Pete Houston" + }, + { + "drilldown" : "Peter Campbell Smith", + "y" : 2, + "name" : "Peter Campbell Smith" + }, + { + "y" : 1, + "name" : "Rage311", + "drilldown" : "Rage311" + }, + { + "y" : 5, + "name" : "Roger Bell_West", + "drilldown" : "Roger Bell_West" + }, + { + "drilldown" : "Simon Green", + "name" : "Simon Green", + "y" : 3 + }, + { + "name" : "Simon Proctor", + "y" : 2, + "drilldown" : "Simon Proctor" + }, + { + "drilldown" : "Steven Wilson", + "name" : "Steven Wilson", + "y" : 1 + }, + { + "name" : "Ulrich Rieke", + "y" : 4, + "drilldown" : "Ulrich Rieke" + }, + { + "name" : "W. Luis Mochan", + "y" : 3, + "drilldown" : "W. Luis Mochan" + }, + { + "name" : "Wanderdoc", + "y" : 2, + "drilldown" : "Wanderdoc" + } + ], + "name" : "The Weekly Challenge - 133" + } + ] } diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json index c7a7723eb2..5e09fa822b 100644 --- a/stats/pwc-language-breakdown-summary.json +++ b/stats/pwc-language-breakdown-summary.json @@ -1,31 +1,30 @@ { - "yAxis" : { - "min" : 0, - "title" : { - "text" : null - } + "legend" : { + "enabled" : "false" + }, + "tooltip" : { + "pointFormat" : "<b>{point.y:.0f}</b>" }, "title" : { "text" : "The Weekly Challenge Contributions [2019 - 2021]" }, "subtitle" : { - "text" : "Last updated at 2021-10-10 16:09:13 GMT" - }, - "legend" : { - "enabled" : "false" - }, - "xAxis" : { - "labels" : { - "style" : { - "fontFamily" : "Verdana, sans-serif", - "fontSize" : "13px" - } - }, - "type" : "category" + "text" : "Last updated at 2021-10-10 16:15:52 GMT" }, "series" : [ { - "name" : "Contributions", + "dataLabels" : { + "enabled" : "true", + "y" : 10, + "rotation" : -90, + "align" : "right", + "format" : "{point.y:.0f}", + "style" : { + "fontFamily" : "Verdana, sans-serif", + "fontSize" : "13px" + }, + "color" : "#FFFFFF" + }, "data" : [ [ "Blog", @@ -33,31 +32,32 @@ ], [ "Perl", - 6337 + 6339 ], [ "Raku", 3886 ] ], - "dataLabels" : { - "color" : "#FFFFFF", - "format" : "{point.y:.0f}", - "style" : { - "fontSize" : "13px", - "fontFamily" : "Verdana, sans-serif" - }, - "align" : "right", - "y" : 10, - "rotation" : -90, - "enabled" : "true" - } + "name" : "Contributions" } ], - "tooltip" : { - "pointFormat" : "<b>{point.y:.0f}</b>" + "yAxis" : { + "min" : 0, + "title" : { + "text" : null + } }, "chart" : { "type" : "column" + }, + "xAxis" : { + "labels" : { + "style" : { + "fontSize" : "13px", + "fontFamily" : "Verdana, sans-serif" + } + }, + "type" : "category" } } diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json index 1bbc064807..ed36c8661e 100644 --- a/stats/pwc-language-breakdown.json +++ b/stats/pwc-language-breakdown.json @@ -1,693 +1,4 @@ { - "legend" : { - "enabled" : "false" - }, - "subtitle" : { - "text" : "Click the columns to drilldown the language breakdown. Last updated at 2021-10-10 16:09:13 GMT" - }, - "yAxis" : { - "title" : { - "text" : "Total Solutions" - } - }, - "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/>" - }, - "series" : [ - { - "colorByPoint" : "true", - "name" : "The Weekly Challenge Languages", - "data" : [ - { - "name" : "#001", - "drilldown" : "001", - "y" : 161 - }, - { - "y" : 125, - "drilldown" : "002", - "name" : "#002" - }, - { - "y" : 81, - "drilldown" : "003", - "name" : "#003" - }, - { - "y" : 99, - "name" : "#004", - "drilldown" : "004" - }, - { - "drilldown" : "005", - "name" : "#005", - "y" : 78 - }, - { - "y" : 58, - "drilldown" : "006", - "name" : "#006" - }, - { - "y" : 64, - "name" : "#007", - "drilldown" : "007" - }, - { - "y" : 78, - "drilldown" : "008", - "name" : "#008" - }, - { - "y" : 76, - "drilldown" : "009", - "name" : "#009" - }, - { - "y" : 65, - "drilldown" : "010", - "name" : "#010" - }, - { - "y" : 85, - "name" : "#011", - "drilldown" : "011" - }, - { - "y" : 89, - "drilldown" : "012", - "name" : "#012" - }, - { - "y" : 85, - "drilldown" : "013", - "name" : "#013" - }, - { - "y" : 101, - "drilldown" : "014", - "name" : "#014" - }, - { - "name" : "#015", - "drilldown" : "015", - "y" : 99 - }, - { - "y" : 71, - "name" : "#016", - "drilldown" : "016" - }, - { - "name" : "#017", - "drilldown" : "017", - "y" : 84 - }, - { - "y" : 81, - "name" : "#018", - "drilldown" : "018" - }, - { - "name" : "#019", - "drilldown" : "019", - "y" : 103 - }, - { - "y" : 101, - "drilldown" : "020", - "name" : "#020" - }, - { - "y" : 72, - "drilldown" : "021", - "name" : "#021" - }, - { - "y" : 68, - "name" : "#022", - "drilldown" : "022" - }, - { - "y" : 97, - "drilldown" : "023", - "name" : "#023" - }, - { - "drilldown" : "024", - "name" : "#024", - "y" : 75 - }, - { - "y" : 59, - "drilldown" : "025", - "name" : "#025" - }, - { - "y" : 74, - "name" : "#026", - "drilldown" : "026" - }, - { - "name" : "#027", - "drilldown" : "027", - "y" : 60 - }, - { - "y" : 80, - "name" : "#028", - "drilldown" : "028" - }, - { - "drilldown" : "029", - "name" : "#029", - "y" : 79 - }, - { - "name" : "#030", - "drilldown" : "030", - "y" : 117 - }, - { - "y" : 89, - "name" : "#031", - |
