diff options
| -rw-r--r-- | challenge-072/pete-houston/awk/ch-1.awk | 29 | ||||
| -rw-r--r-- | challenge-072/pete-houston/awk/ch-2.awk | 18 | ||||
| -rw-r--r-- | challenge-072/pete-houston/perl/ch-1.pl | 30 | ||||
| -rw-r--r-- | challenge-072/pete-houston/perl/ch-2.pl | 29 | ||||
| -rw-r--r-- | stats/pwc-current.json | 171 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown-summary.json | 60 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown.json | 484 | ||||
| -rw-r--r-- | stats/pwc-leaders.json | 750 | ||||
| -rw-r--r-- | stats/pwc-summary-1-30.json | 126 | ||||
| -rw-r--r-- | stats/pwc-summary-121-150.json | 30 | ||||
| -rw-r--r-- | stats/pwc-summary-151-180.json | 18 | ||||
| -rw-r--r-- | stats/pwc-summary-31-60.json | 112 | ||||
| -rw-r--r-- | stats/pwc-summary-61-90.json | 118 | ||||
| -rw-r--r-- | stats/pwc-summary-91-120.json | 36 | ||||
| -rw-r--r-- | stats/pwc-summary.json | 54 |
15 files changed, 1093 insertions, 972 deletions
diff --git a/challenge-072/pete-houston/awk/ch-1.awk b/challenge-072/pete-houston/awk/ch-1.awk new file mode 100644 index 0000000000..cc8b3bbc2f --- /dev/null +++ b/challenge-072/pete-houston/awk/ch-1.awk @@ -0,0 +1,29 @@ +#!/usr/bin/gawk -f +#=============================================================================== +# +# FILE: 7201.awk +# +# DESCRIPTION: Given a whole number N display the number of trailing +# zeros in N! +# +# NOTES: The task was up to N = 10 but this works up to 22 on a +# 64-bit platform. Tested on gawk but should work on most +# awks. +# AUTHOR: Pete Houston (pete), cpan@openstrike.co.uk +# ORGANIZATION: Openstrike +# VERSION: 1.0 +# CREATED: 03/08/20 +#=============================================================================== +BEGIN { print "Enter a whole number on each line." } +!/^[0-9]+$/ { print "Input is not a whole number - skipping"; next; } +$1 > 22 { print "Too big for integer type - skipping"; next; } +{ + f = x = $1; + while (x > 2) { + x--; + f = f * x; + } + print "Factorial is " f; + match (f, /0*$/); + print "Trailing zeros: " RLENGTH; +} diff --git a/challenge-072/pete-houston/awk/ch-2.awk b/challenge-072/pete-houston/awk/ch-2.awk new file mode 100644 index 0000000000..31b580817d --- /dev/null +++ b/challenge-072/pete-houston/awk/ch-2.awk @@ -0,0 +1,18 @@ +#!/usr/bin/gawk -f +#=============================================================================== +# +# FILE: 7202.awk +# USAGE: 7202.awk X Y filename [ filename ... ] +# +# DESCRIPTION: Only print the lines of the supplied file(s) between +# line numbers X and Y inclusive. +# +# NOTES: Arguments X and Y are whole numbers. Y >= X, X >= 1. +# AUTHOR: Pete Houston (pete), cpan@openstrike.co.uk +# ORGANIZATION: Openstrike +# VERSION: 1.0 +# CREATED: 04/08/20 +#=============================================================================== +BEGIN { start = ARGV[1]; finish = ARGV[2]; delete ARGV[2]; delete ARGV[1]; } +FNR > finish { nextfile; } +FNR >= start diff --git a/challenge-072/pete-houston/perl/ch-1.pl b/challenge-072/pete-houston/perl/ch-1.pl new file mode 100644 index 0000000000..6a72e6f57f --- /dev/null +++ b/challenge-072/pete-houston/perl/ch-1.pl @@ -0,0 +1,30 @@ +#!/usr/bin/env perl +#=============================================================================== +# +# FILE: 7201.pl +# +# USAGE: ./7201.pl N [ N ... ] +# +# DESCRIPTION: Given a whole number N display the number of trailing +# zeros in N! +# +# REQUIREMENTS: Math::GMP, Params::Util, Lingua::EN::Inflexion +# NOTES: Unclever but effective. The task was up to N = 10 but +# this seems good for any arbitrary N thanks to Math::GMP. +# AUTHOR: Pete Houston (pete), cpan@openstrike.co.uk +# ORGANIZATION: Openstrike +# VERSION: 1.0 +# CREATED: 03/08/20 +#=============================================================================== + +use strict; +use warnings; +use Math::GMP; +use Params::Util '_POSINT'; +use Lingua::EN::Inflexion; + +for my $n (@ARGV) { + next unless _POSINT ($n); + my $z =()= Math::GMP->new($n)->bfac =~ /0(?=0*$)/g; + print inflect ("$n! has <#n:$z> trailing <N:zero>\n"); +} diff --git a/challenge-072/pete-houston/perl/ch-2.pl b/challenge-072/pete-houston/perl/ch-2.pl new file mode 100644 index 0000000000..4bcb7862ec --- /dev/null +++ b/challenge-072/pete-houston/perl/ch-2.pl @@ -0,0 +1,29 @@ +#!/usr/bin/env perl +#=============================================================================== +# +# FILE: 7202.pl +# +# USAGE: ./7202.pl LINEA LINEB FILE [ FILE ... ] +# +# DESCRIPTION: Display lines from number A to B inclusive of FILE on STDOUT +# +# NOTES: Optimised for memory, not speed +# AUTHOR: Pete Houston (pete), cpan@openstrike.co.uk +# ORGANIZATION: Openstrike +# VERSION: 1.0 +# CREATED: 04/08/20 +#=============================================================================== + +use strict; +use warnings; +use autodie; + +my $start = shift @ARGV; +my $end = shift @ARGV; +print "start = $start, end = $end\n"; +for my $file (@ARGV) { + open my $in, '<', $file; + <$in> for 2 .. $start; + print '' . <$in> for ($start .. $end); + close $in; +} diff --git a/stats/pwc-current.json b/stats/pwc-current.json index d7f31912e1..9c86126719 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -1,63 +1,63 @@ { - "yAxis" : { - "title" : { - "text" : "Total Solutions" - } - }, "subtitle" : { - "text" : "[Champions: 20] Last updated at 2020-08-05 20:47:28 GMT" + "text" : "[Champions: 21] Last updated at 2020-08-06 14:59:55 GMT" }, "plotOptions" : { "series" : { + "borderWidth" : 0, "dataLabels" : { "enabled" : 1, "format" : "{point.y}" - }, - "borderWidth" : 0 + } + } + }, + "yAxis" : { + "title" : { + "text" : "Total Solutions" } }, "series" : [ { "data" : [ { + "y" : 3, "name" : "Andrew Shitov", - "drilldown" : "Andrew Shitov", - "y" : 3 + "drilldown" : "Andrew Shitov" }, { - "y" : 2, + "name" : "Bob Lied", "drilldown" : "Bob Lied", - "name" : "Bob Lied" + "y" : 2 }, { - "y" : 2, + "name" : "Duncan C. White", "drilldown" : "Duncan C. White", - "name" : "Duncan C. White" + "y" : 2 }, { + "name" : "E. Choroba", "drilldown" : "E. Choroba", - "y" : 2, - "name" : "E. Choroba" + "y" : 2 }, { - "y" : 2, "drilldown" : "Jan Krnavek", - "name" : "Jan Krnavek" + "name" : "Jan Krnavek", + "y" : 2 }, { - "name" : "Jason Messer", "y" : 2, - "drilldown" : "Jason Messer" + "drilldown" : "Jason Messer", + "name" : "Jason Messer" }, { - "y" : 5, "drilldown" : "Javier Luque", - "name" : "Javier Luque" + "name" : "Javier Luque", + "y" : 5 }, { "name" : "Jorg Sommrey", - "y" : 2, - "drilldown" : "Jorg Sommrey" + "drilldown" : "Jorg Sommrey", + "y" : 2 }, { "name" : "Luca Ferrari", @@ -65,72 +65,86 @@ "y" : 4 }, { + "drilldown" : "Mark Anderson", "name" : "Mark Anderson", - "y" : 2, - "drilldown" : "Mark Anderson" + "y" : 2 }, { - "y" : 4, + "name" : "Mohammad S Anwar", "drilldown" : "Mohammad S Anwar", - "name" : "Mohammad S Anwar" + "y" : 4 }, { - "y" : 4, + "name" : "Myoungjin Jeon", "drilldown" : "Myoungjin Jeon", - "name" : "Myoungjin Jeon" + "y" : 4 }, { - "name" : "Niels van Dijke", "y" : 2, + "name" : "Niels van Dijke", "drilldown" : "Niels van Dijke" }, { + "drilldown" : "Pete Houston", + "name" : "Pete Houston", + "y" : 2 + }, + { "y" : 5, "drilldown" : "Roger Bell_West", "name" : "Roger Bell_West" }, { "drilldown" : "Simon Miner", - "y" : 2, - "name" : "Simon Miner" + "name" : "Simon Miner", + "y" : 2 }, { - "name" : "Simon Proctor", "y" : 2, + "name" : "Simon Proctor", "drilldown" : "Simon Proctor" }, { + "name" : "Ulrich Rieke", "drilldown" : "Ulrich Rieke", - "y" : 4, - "name" : "Ulrich Rieke" + "y" : 4 }, { - "name" : "Walt Mankowski", "drilldown" : "Walt Mankowski", + "name" : "Walt Mankowski", "y" : 3 }, { + "drilldown" : "Wanderdoc", "name" : "Wanderdoc", - "y" : 2, - "drilldown" : "Wanderdoc" + "y" : 2 }, { + "name" : "Yary Hluchan", "drilldown" : "Yary Hluchan", - "y" : 2, - "name" : "Yary Hluchan" + "y" : 2 } ], "name" : "Perl Weekly Challenge - 072", "colorByPoint" : 1 } ], - "legend" : { - "enabled" : 0 + "title" : { + "text" : "Perl Weekly Challenge - 072" + }, + "tooltip" : { + "headerFormat" : "<span style='font-size:11px'>{series.name}</span><br/>", + "followPointer" : 1, + "pointFormat" : "<span style='color:{point.color}'>{point.name}</span>: <b>{point.y:f}</b><br/>" + }, + "chart" : { + "type" : "column" }, "drilldown" : { "series" : [ { "id" : "Andrew Shitov", + "name" : "Andrew Shitov", "data" : [ [ "Raku", @@ -140,8 +154,7 @@ "Blog", 1 ] - ], - "name" : "Andrew Shitov" + ] }, { "id" : "Bob Lied", @@ -154,24 +167,24 @@ "name" : "Bob Lied" }, { - "name" : "Duncan C. White", + "id" : "Duncan C. White", "data" : [ [ "Perl", 2 ] ], - "id" : "Duncan C. White" + "name" : "Duncan C. White" }, { "id" : "E. Choroba", - "name" : "E. Choroba", "data" : [ [ "Perl", 2 ] - ] + ], + "name" : "E. Choroba" }, { "id" : "Jan Krnavek", @@ -184,14 +197,14 @@ "name" : "Jan Krnavek" }, { + "id" : "Jason Messer", + "name" : "Jason Messer", "data" : [ [ "Raku", 2 ] - ], - "name" : "Jason Messer", - "id" : "Jason Messer" + ] }, { "name" : "Javier Luque", @@ -213,13 +226,13 @@ }, { "id" : "Jorg Sommrey", + "name" : "Jorg Sommrey", "data" : [ [ "Perl", 2 ] - ], - "name" : "Jorg Sommrey" + ] }, { "name" : "Luca Ferrari", @@ -236,14 +249,14 @@ "id" : "Luca Ferrari" }, { - "id" : "Mark Anderson", + "name" : "Mark Anderson", "data" : [ [ "Raku", 2 ] ], - "name" : "Mark Anderson" + "id" : "Mark Anderson" }, { "data" : [ @@ -274,18 +287,27 @@ "id" : "Myoungjin Jeon" }, { - "id" : "Niels van Dijke", + "data" : [ + [ + "Perl", + 2 + ] + ], "name" : "Niels van Dijke", + "id" : "Niels van Dijke" + }, + { "data" : [ [ "Perl", 2 ] - ] + ], + "name" : "Pete Houston", + "id" : "Pete Houston" }, { "id" : "Roger Bell_West", - "name" : "Roger Bell_West", "data" : [ [ "Perl", @@ -299,16 +321,17 @@ "Blog", 1 ] - ] + ], + "name" : "Roger Bell_West" }, { + "name" : "Simon Miner", "data" : [ [ "Perl", 2 ] ], - "name" : "Simon Miner", "id" : "Simon Miner" }, { @@ -322,7 +345,6 @@ "name" : "Simon Proctor" }, { - "id" : "Ulrich Rieke", "data" : [ [ "Perl", @@ -333,7 +355,8 @@ 2 ] ], - "name" : "Ulrich Rieke" + "name" : "Ulrich Rieke", + "id" : "Ulrich Rieke" }, { "data" : [ @@ -350,17 +373,17 @@ "id" : "Walt Mankowski" }, { + "id" : "Wanderdoc", + "name" : "Wanderdoc", "data" : [ [ "Perl", 2 ] - ], - "name" : "Wanderdoc", - "id" : "Wanderdoc" + ] }, { - "id" : "Yary Hluchan", + "name" : "Yary Hluchan", "data" : [ [ "Perl", @@ -371,22 +394,14 @@ 1 ] ], - "name" : "Yary Hluchan" + "id" : "Yary Hluchan" } ] }, "xAxis" : { "type" : "category" }, - "tooltip" : { - "pointFormat" : "<span style='color:{point.color}'>{point.name}</span>: <b>{point.y:f}</b><br/>", - "followPointer" : 1, - "headerFormat" : "<span style='font-size:11px'>{series.name}</span><br/>" - }, - "title" : { - "text" : "Perl Weekly Challenge - 072" - }, - "chart" : { - "type" : "column" + "legend" : { + "enabled" : 0 } } diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json index 6385238ac2..51868e69d5 100644 --- a/stats/pwc-language-breakdown-summary.json +++ b/stats/pwc-language-breakdown-summary.json @@ -1,18 +1,15 @@ { + "subtitle" : { + "text" : "Last updated at 2020-08-06 14:59:55 GMT" + }, + "yAxis" : { + "min" : 0, + "title" : { + "text" : null + } + }, "series" : [ { - "dataLabels" : { - "rotation" : -90, - "align" : "right", - "format" : "{point.y:.0f}", - "color" : "#FFFFFF", - "y" : 10, - "enabled" : "true", - "style" : { - "fontFamily" : "Verdana, sans-serif", - "fontSize" : "13px" - } - }, "data" : [ [ "Blog", @@ -20,24 +17,36 @@ ], [ "Perl", - 2965 + 2967 ], [ "Raku", 1925 ] ], - "name" : "Contributions" + "name" : "Contributions", + "dataLabels" : { + "style" : { + "fontSize" : "13px", + "fontFamily" : "Verdana, sans-serif" + }, + "align" : "right", + "rotation" : -90, + "format" : "{point.y:.0f}", + "color" : "#FFFFFF", + "enabled" : "true", + "y" : 10 + } } ], - "subtitle" : { - "text" : "Last updated at 2020-08-05 20:47:28 GMT" + "chart" : { + "type" : "column" }, - "yAxis" : { - "title" : { - "text" : null - }, - "min" : 0 + "tooltip" : { + "pointFormat" : "<b>{point.y:.0f}</b>" + }, + "title" : { + "text" : "Perl Weekly Challenge Contributions [2019 - 2020]" }, "legend" : { "enabled" : "false" @@ -50,14 +59,5 @@ "fontSize" : "13px" } } - }, - "tooltip" : { - "pointFormat" : "<b>{point.y:.0f}</b>" - }, - "chart" : { - "type" : "column" - }, - "title" : { - "text" : "Perl Weekly Challenge Contributions [2019 - 2020]" } } diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json index c94115f1d0..5e31b65bd5 100644 --- a/stats/pwc-language-breakdown.json +++ b/stats/pwc-language-breakdown.json @@ -1,49 +1,51 @@ { - "legend" : { - "enabled" : "false" + "plotOptions" : { + "series" : { + "borderWidth" : 0, + "dataLabels" : { + "format" : "{point.y}", + "enabled" : 1 + } + } }, "yAxis" : { "title" : { "text" : "Total Solutions" } }, - "subtitle" : { - "text" : "Click the columns to drilldown the language breakdown. Last updated at 2020-08-05 20:47:28 GMT" - }, "series" : [ { - "colorByPoint" : "true", "name" : "Perl Weekly Challenge Languages", "data" : [ { + "drilldown" : "001", "name" : "#001", - "y" : 142, - "drilldown" : "001" + "y" : 142 }, { - "name" : "#002", "drilldown" : "002", + "name" : "#002", "y" : 109 }, { - "y" : 71, "drilldown" : "003", - "name" : "#003" + "name" : "#003", + "y" : 71 }, { - "drilldown" : "004", "y" : 91, - "name" : "#004" + "name" : "#004", + "drilldown" : "004" }, { + "drilldown" : "005", "name" : "#005", - "y" : 72, - "drilldown" : "005" + "y" : 72 }, { - "drilldown" : "006", "y" : 52, - "name" : "#006" + "name" : "#006", + "drilldown" : "006" }, { "y" : 59, @@ -51,84 +53,84 @@ "name" : "#007" }, { - "y" : 72, + "name" : "#008", "drilldown" : "008", - "name" : "#008" + "y" : 72 }, { - "drilldown" : "009", "y" : 68, - "name" : "#009" + "name" : "#009", + "drilldown" : "009" }, { + "drilldown" : "010", "name" : "#010", - "y" : 60, - "drilldown" : "010" + "y" : 60 }, { - "drilldown" : "011", "y" : 79, - "name" : "#011" + "name" : "#011", + "drilldown" : "011" }, { - "drilldown" : "012", "y" : 83, + "drilldown" : "012", "name" : "#012" }, { "y" : 76, - "drilldown" : "013", - "name" : "#013" + "name" : "#013", + "drilldown" : "013" }, { - "y" : 96, "drilldown" : "014", - "name" : "#014" + "name" : "#014", + "y" : 96 }, { "drilldown" : "015", - "y" : 93, - "name" : "#015" + "name" : "#015", + "y" : 93 }, { - "drilldown" : "016", "y" : 66, - "name" : "#016" + "name" : "#016", + "drilldown" : "016" }, { - "name" : "#017", + "y" : 79, "drilldown" : "017", - "y" : 79 + "name" : "#017" }, { + "y" : 76, "name" : "#018", - "drilldown" : "018", - "y" : 76 + "drilldown" : "018" }, { + "name" : "#019", "drilldown" : "019", - "y" : 97, - "name" : "#019" + "y" : 97 }, { + "drilldown" : "020", "name" : "#020", - "y" : 95, - "drilldown" : "020" + "y" : 95 }, { - "y" : 67, + "name" : "#021", "drilldown" : "021", - "name" : "#021" + "y" : 67 }, { - "name" : "#022", "drilldown" : "022", + "name" : "#022", "y" : 63 }, { "drilldown" : "023", - "y" : 91, - "name" : "#023" + "name" : "#023", + "y" : 91 }, { "y" : 70, @@ -136,9 +138,9 @@ "name" : "#024" }, { - "y" : 55, + "name" : "#025", "drilldown" : "025", - "name" : "#025" + "y" : 55 }, { "name" : "#026", @@ -146,29 +148,29 @@ "y" : 70 }, { - "drilldown" : "027", "y" : 58, - "name" : "#027" + "name" : "#027", + "drilldown" : "027" }, { - "drilldown" : "028", "y" : 78, + "drilldown" : "028", "name" : "#028" }, { - "drilldown" : "029", "y" : 77, + "drilldown" : "029", "name" : "#029" }, { "drilldown" : "030", - "y" : 115, - "name" : "#030" + "name" : "#030", + "y" : 115 }, { - "y" : 87, "drilldown" : "031", - "name" : "#031" + "name" : "#031", + "y" : 87 }, { "name" : "#032", @@ -176,24 +178,24 @@ "y" : 92 }, { - "drilldown" : "033", "y" : 108, + "drilldown" : "033", "name" : "#033" }, { - "name" : "#034", "y" : 62, - "drilldown" : "034" + "drilldown" : "034", + "name" : "#034" }, { "drilldown" : "035", - "y" : 62, - "name" : "#035" + "name" : "#035", + "y" : 62 }, { + "y" : 66, "name" : "#036", - "drilldown" : "036", - "y" : 66 + "drilldown" : "036" }, { "y" : 65, @@ -201,84 +203,84 @@ "name" : "#037" }, { - "drilldown" : "038", "y" : 65, - "name" : "#038" + "name" : "#038", + "drilldown" : "038" }, { - "y" : 60, "drilldown" : "039", - "name" : "#039" + "name" : "#039", + "y" : 60 }, { - "drilldown" : "040", "y" : 71, - "name" : "#040" + "name" : "#040", + "drilldown" : "040" }, { - "name" : "#041", "y" : 74, + "name" : "#041", "drilldown" : "041" }, { "drilldown" : "042", - "y" : 88, - "name" : "#042" + "name" : "#042", + "y" : 88 }, { - "name" : "#043", "y" : 66, + "name" : "#043", "drilldown" : "043" }, { - "name" : "#044", "y" : 82, - "drilldown" : "044" + "drilldown" : "044", + "name" : "#044" }, { "y" : 94, - "drilldown" : "045", - "name" : "#045" + "name" : "#045", + "drilldown" : "045" }, { - "name" : "#046", + "y" : 85, "drilldown" : "046", - "y" : 85 + "name" : "#046" }, { - "drilldown" : "047", "y" : 82, + "drilldown" : "047", "name" : "#047" }, { - "y" : 106, + "name" : "#048", "drilldown" : "048", - "name" : "#048" + "y" : 106 }, { - "y" : 85, "drilldown" : "049", - "name" : "#049" + "name" : "#049", + "y" : 85 }, { + "name" : "#050", "drilldown" : "050", - "y" : 96, - "name" : "#050" + "y" : 96 }, { "y" : 87, - "drilldown" : "051", - "name" : "#051" + "name" : "#051", + "drilldown" : "051" }, { - "name" : "#052", "drilldown" : "052", + "name" : "#052", "y" : 89 }, { + "name" : "#053", "drilldown" : "053", - "y" : 99, - "name" : "#053" + "y" : 99 }, { "y" : 101, @@ -286,24 +288,24 @@ "name" : "#054" }, { - "drilldown" : "055", "y" : 86, + "drilldown" : "055", "name" : "#055" }, { - "name" : "#056", "y" : 93, - "drilldown" : "056" + "drilldown" : "056", + "name" : "#056" }, { + "name" : "#057", "drilldown" : "057", - "y" : 78, - "name" : "#057" + "y" : 78 }, { + "y" : 67, "name" : "#058", - "drilldown" : "058", - "y" : 67 + "drilldown" : "058" }, { "name" : "#059", @@ -311,92 +313,76 @@ "y" : 82 }, { - "name" : "#060", "y" : 83, - "drilldown" : "060" + "drilldown" : "060", + "name" : "#060" }, { - "name" : "#061", + "y" : 79, "drilldown" : "061", - "y" : 79 + "name" : "#061" }, { - "name" : "#062", + "y" : 54, "drilldown" : "062", - "y" : 54 + "name" : "#062" }, { - "name" : "#063", + "y" : 87, "drilldown" : "063", - "y" : 87 + "name" : "#063" }, { + "name" : "#064", "drilldown" : "064", - "y" : 76, - "name" : "#064" + "y" : 76 }, { "drilldown" : "065", - "y" : 71, - "name" : "#065" + "name" : "#065", + "y" : 71 }, { - "name" |
