From 6e4d71a805f0e3eb9ed156d3a620b2ac9b0c76c8 Mon Sep 17 00:00:00 2001 From: boblied Date: Tue, 16 Mar 2021 09:26:12 -0500 Subject: Update README for 104 --- challenge-104/bob-lied/README | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/challenge-104/bob-lied/README b/challenge-104/bob-lied/README index 8417e3a7f7..0eda339cbd 100644 --- a/challenge-104/bob-lied/README +++ b/challenge-104/bob-lied/README @@ -1,3 +1,3 @@ -Solutions to weekly challenge 103 by Bob Lied. +Solutions to weekly challenge 104 by Bob Lied. -https://perlweeklychallenge.org/blog/perl-weekly-challenge-103/ +https://perlweeklychallenge.org/blog/perl-weekly-challenge-104/ -- cgit From d30c5dd97805299438b57e902847a90be3e4d513 Mon Sep 17 00:00:00 2001 From: boblied Date: Tue, 16 Mar 2021 09:26:41 -0500 Subject: Solution for PWC 104 #1, FUSC sequence --- challenge-104/bob-lied/perl/ch-1.pl | 84 +++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100755 challenge-104/bob-lied/perl/ch-1.pl diff --git a/challenge-104/bob-lied/perl/ch-1.pl b/challenge-104/bob-lied/perl/ch-1.pl new file mode 100755 index 0000000000..893566e574 --- /dev/null +++ b/challenge-104/bob-lied/perl/ch-1.pl @@ -0,0 +1,84 @@ +#!/usr/bin/env perl +# vim:set ts=4 sw=4 sts=4 et ai wm=0 nu: +#============================================================================= +# ch-1.pl +#============================================================================= +# Copyright (c) 2021, Bob Lied +#============================================================================= +# Perl Weekly Challenge 104, Task #1, FUSC Sequence +# Write a script to generate first 50 members of FUSC Sequence. Please refer +# to OEIS for more information. The sequence defined as below: +# +# fusc(0) = 0 +# fusc(1) = 1 +# for n > 1: +# when n is even: fusc(n) = fusc(n / 2), +# when n is odd: fusc(n) = fusc((n-1)/2) + fusc((n+1)/2) +# +#============================================================================= + +use strict; +use warnings; +use v5.32; + +use experimental qw/ signatures /; +no warnings "experimental::signatures"; + +use Memoize; + +use Getopt::Long; +my $Verbose = 0; +my $DoTest = 0; + +GetOptions("test" => \$DoTest, "verbose" => \$Verbose); +exit(!runTest()) if $DoTest; + +my $N = shift // 50; + +say "$_: ", fusc($_) for 0 .. $N; + +#memoize("fusc"); +sub fusc($n) +{ + use integer; + return 0 if $n == 0; + return 1 if $n == 1; + + return fusc($n/2) if ($n % 2) == 0; + return fusc(($n-1)/2) + fusc(($n+1)/2); +} + +sub runTest +{ + use Test::More; + + is( fusc( 0), 0, "fusc( 0)"); + is( fusc( 1), 1, "fusc( 1)"); + is( fusc( 2), 1, "fusc( 2)"); + is( fusc( 3), 2, "fusc( 3)"); + is( fusc( 4), 1, "fusc( 4)"); + is( fusc( 5), 3, "fusc( 5)"); + is( fusc( 6), 2, "fusc( 6)"); + is( fusc( 7), 3, "fusc( 7)"); + is( fusc( 8), 1, "fusc( 8)"); + is( fusc( 9), 4, "fusc( 9)"); + is( fusc(10), 3, "fusc(10)"); + is( fusc(11), 5, "fusc(11)"); + is( fusc(12), 2, "fusc(12)"); + is( fusc(13), 5, "fusc(13)"); + is( fusc(14), 3, "fusc(14)"); + is( fusc(15), 4, "fusc(15)"); + is( fusc(16), 1, "fusc(16)"); + is( fusc(20), 3, "fusc(20)"); + is( fusc(30), 4, "fusc(30)"); + is( fusc(40), 3, "fusc(40)"); + is( fusc(50), 7, "fusc(50)"); + is( fusc(60), 4, "fusc(60)"); + is( fusc(70), 9, "fusc(70)"); + is( fusc(80), 3, "fusc(80)"); + is( fusc(90), 12, "fusc(90)"); + + + done_testing; +} + -- cgit From 0e851de358a804fa5df6cbf8d5e94ee08a455fb7 Mon Sep 17 00:00:00 2001 From: 冯昶 Date: Mon, 7 Jun 2021 11:25:40 +0800 Subject: challenge 116, raku solutions --- challenge-116/feng-chang/raku/ch-1.raku | 18 ++++++++++++++++++ challenge-116/feng-chang/raku/ch-2.raku | 5 +++++ 2 files changed, 23 insertions(+) create mode 100755 challenge-116/feng-chang/raku/ch-1.raku create mode 100755 challenge-116/feng-chang/raku/ch-2.raku diff --git a/challenge-116/feng-chang/raku/ch-1.raku b/challenge-116/feng-chang/raku/ch-1.raku new file mode 100755 index 0000000000..f6191bcb70 --- /dev/null +++ b/challenge-116/feng-chang/raku/ch-1.raku @@ -0,0 +1,18 @@ +#!/bin/env raku + +sub MAIN(UInt:D $N where * ≥ 10) { + for 1 .. $N.chars div 2 -> $len { + my $n = $N; + my $i = $n.substr(0, $len); + while $n.chars > 0 { + last unless $n.substr(0, $i.chars) eq $i; + $n .= substr($i.chars); + ++$i; + } + if $n.chars == 0 { + put 1; + exit; + } + } + put 0; +} diff --git a/challenge-116/feng-chang/raku/ch-2.raku b/challenge-116/feng-chang/raku/ch-2.raku new file mode 100755 index 0000000000..8ece4d5102 --- /dev/null +++ b/challenge-116/feng-chang/raku/ch-2.raku @@ -0,0 +1,5 @@ +#!/bin/env raku + +sub MAIN(UInt:D $N where * ≥ 10) { + put $N.comb».Int.map(*²).reduce(&infix:<+>).&{ +(sqrt($_).Int² == $_) }; +} -- cgit From 3cfc7a5a647163b2c9aff624d86d0ff9bec7532a Mon Sep 17 00:00:00 2001 From: Abigail Date: Mon, 7 Jun 2021 17:58:18 +0200 Subject: README for week 116 --- challenge-116/abigail/README.md | 66 +++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 39 deletions(-) diff --git a/challenge-116/abigail/README.md b/challenge-116/abigail/README.md index 96adeb6d8f..629117cbfb 100644 --- a/challenge-116/abigail/README.md +++ b/challenge-116/abigail/README.md @@ -1,64 +1,52 @@ # Solutions by Abigail -## [String Chain](https://perlweeklychallenge.org/blog/perl-weekly-challenge-115/#TASK1) +## [Number Sequence](https://perlweeklychallenge.org/blog/perl-weekly-challenge-116/#TASK1) -> You are given an array of strings. +> You are given a number `$N` >= `10`. > -> Write a script to find out if the given strings can be chained -> to form a circle. Print `1` if found otherwise `0`. -> -> > A string `$S` can be put before another string `$T` in circle -> > if the last character of `$S` is same as first character of `$T`. +> Write a script to split the given number such that the difference +> between two consecutive numbers is always 1 and it shouldn't have +> leading `0`. +> +> Print the given number if it impossible to split the number. ### Example ~~~~ -Input: @S = ("abc", "dea", "cd") -Output: 1 as we can form circle e.g. "abc", "cd", "dea". +Input: $N = 1234 +Output: 1,2,3,4 + +Input: $N = 91011 +Output: 9,10,11 -Input: @S = ("ade", "cbd", "fgh") -Output: 0 as we can't form circle. +Input: $N = 10203 +Output: 10203 as it is impossible to split satisfying the conditions. ~~~~ ### Solutions -* [AWK](awk/ch-1.awk) -* [Bash](bash/ch-1.sh) -* [C](c/ch-1.c) -* [Lua](lua/ch-1.lua) -* [Node.js](node/ch-1.js) -* [Perl](perl/ch-1.pl) -* [Python](python/ch-1.py) -* [Ruby](ruby/ch-1.rb) ### Blog -[String Chain](https://abigail.github.io/HTML/Perl-Weekly-Challenge/week-115-1.html) +[Number Sequence](https://abigail.github.io/HTML/Perl-Weekly-Challenge/week-116-1.html) -## [Largest Multiple](https://perlweeklychallenge.org/blog/perl-weekly-challenge-115/#TASK2) +## [Sum of Squares](https://perlweeklychallenge.org/blog/perl-weekly-challenge-115/#TASK2) -> You are given a list of positive integers `(0-9)`, single digit. +> You are given a number $N >= 10. > -> Write a script to find the largest multiple of `2` that can be -> formed from the list. +> Write a script to find out if the given number `$N` is such that +> sum of squares of all digits is a perfect square. +> Print `1` if it is otherwise `0`. ### Examples ~~~~ -Input: @N = (1, 0, 2, 6) -Output: 6210 +Input: $N = 34 +Ouput: 1 as 3^2 + 4^2 => 9 + 16 => 25 => 5^2 -Input: @N = (1, 4, 2, 8) -Output: 8412 +Input: $N = 50 +Output: 1 as 5^2 + 0^2 => 25 + 0 => 25 => 5^2 -Input: @N = (4, 1, 7, 6) -Output: 7614 +Input: $N = 52 +Output: 0 as 5^2 + 2^2 => 25 + 4 => 29 ~~~~ ### Solutions -* [AWK](awk/ch-2.awk) -* [Bash](bash/ch-2.sh) -* [C](c/ch-2.c) -* [Lua](lua/ch-2.lua) -* [Node.js](node/ch-2.js) -* [Perl](perl/ch-2.pl) -* [Python](python/ch-2.py) -* [Ruby](ruby/ch-2.rb) ### Blog -[Largest Multiple](https://abigail.github.io/HTML/Perl-Weekly-Challenge/week-115-2.html) +[Sum of Squares](https://abigail.github.io/HTML/Perl-Weekly-Challenge/week-116-2.html) -- cgit From f08a13f3afd794045d93196c78b2c75f4959bd10 Mon Sep 17 00:00:00 2001 From: Abigail Date: Mon, 7 Jun 2021 17:59:53 +0200 Subject: Test cases for week 116 --- challenge-116/abigail/t/ctest.ini | 8 ++++++++ challenge-116/abigail/t/input-1-1 | 3 +++ challenge-116/abigail/t/input-2-1 | 3 +++ challenge-116/abigail/t/output-1-1.exp | 3 +++ challenge-116/abigail/t/output-2-1.exp | 3 +++ 5 files changed, 20 insertions(+) create mode 100644 challenge-116/abigail/t/ctest.ini create mode 100644 challenge-116/abigail/t/input-1-1 create mode 100644 challenge-116/abigail/t/input-2-1 create mode 100644 challenge-116/abigail/t/output-1-1.exp create mode 100644 challenge-116/abigail/t/output-2-1.exp diff --git a/challenge-116/abigail/t/ctest.ini b/challenge-116/abigail/t/ctest.ini new file mode 100644 index 0000000000..527781acbb --- /dev/null +++ b/challenge-116/abigail/t/ctest.ini @@ -0,0 +1,8 @@ +# +# Configuration file for running tests, using ctest. +# See https://github.com/Abigail/Misc/blob/master/ctest +# + +[names] +1-1 = Given Examples +2-1 = Given Examples diff --git a/challenge-116/abigail/t/input-1-1 b/challenge-116/abigail/t/input-1-1 new file mode 100644 index 0000000000..e0e9503285 --- /dev/null +++ b/challenge-116/abigail/t/input-1-1 @@ -0,0 +1,3 @@ +1234 +91011 +10203 diff --git a/challenge-116/abigail/t/input-2-1 b/challenge-116/abigail/t/input-2-1 new file mode 100644 index 0000000000..93e3c204ca --- /dev/null +++ b/challenge-116/abigail/t/input-2-1 @@ -0,0 +1,3 @@ +34 +50 +52 diff --git a/challenge-116/abigail/t/output-1-1.exp b/challenge-116/abigail/t/output-1-1.exp new file mode 100644 index 0000000000..c1c54c5e0c --- /dev/null +++ b/challenge-116/abigail/t/output-1-1.exp @@ -0,0 +1,3 @@ +1,2,3,4 +9,10,11 +10203 diff --git a/challenge-116/abigail/t/output-2-1.exp b/challenge-116/abigail/t/output-2-1.exp new file mode 100644 index 0000000000..2f1465d159 --- /dev/null +++ b/challenge-116/abigail/t/output-2-1.exp @@ -0,0 +1,3 @@ +1 +1 +0 -- cgit From 7a0359becf22d29deacefbcb1372ecc484f2e926 Mon Sep 17 00:00:00 2001 From: drbaggy Date: Tue, 8 Jun 2021 11:27:54 +0100 Subject: remove unncessary inequality --- challenge-116/james-smith/perl/ch-1.pl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/challenge-116/james-smith/perl/ch-1.pl b/challenge-116/james-smith/perl/ch-1.pl index b3e2eaeba4..cdd0b29cc4 100644 --- a/challenge-116/james-smith/perl/ch-1.pl +++ b/challenge-116/james-smith/perl/ch-1.pl @@ -45,7 +45,7 @@ sub splitnum { ## it is equal to or larger than the input number ($string .= ++$end) && push @range, $end - while $in gt $string && length $in > length $string; + while length $in > length $string; ## Finally we return the list if the input and ## string are the same. Note we will always get @@ -70,8 +70,7 @@ sub splitnum_no_comments { my( $in, $st ) = ( shift, '' ); for( split //, substr $in, 0, (length $in) >> 1) { my @r = ( my $t = my $en = $st .= $_ ); - ($t .= ++$en) && push @r,$en while $in gt $t - && length $in > length $t; + ($t .= ++$en) && push @r,$en while length $in > length $t; return \@r if $t eq $in; } return [$in]; -- cgit From 3c3666a3adcc85b6b7042ff65a06e2974641e570 Mon Sep 17 00:00:00 2001 From: drbaggy Date: Tue, 8 Jun 2021 11:57:10 +0100 Subject: tidy up code --- challenge-116/james-smith/README.md | 9 ++++----- challenge-116/james-smith/perl/ch-1.pl | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/challenge-116/james-smith/README.md b/challenge-116/james-smith/README.md index 0f0f90a9c8..9d77f3e59f 100644 --- a/challenge-116/james-smith/README.md +++ b/challenge-116/james-smith/README.md @@ -25,15 +25,14 @@ Within each loop we just stitch together the string by incrementing the number e * We use string (in)equalities/incremements so this will work with arbitrarily large numbers (see examples in script) * We reduce the maximum calculations by a factor of 2 by spliting just the first half of the string - * We have to check length as well as the strings in the while condition (because we are using string comparison) + * As we are working with strings rather than numbers we check the lengths in the while condition (because we are using string comparison) ```perl sub splitnum { my( $in, $start ) = ( shift, '' ); - for( split //, substr $in, 0, (length $in) >> 1) { - my @range = ( my $string = my $end = $start .= $_ ); - ($string .= ++$end) && push @range, $end - while $in gt $string && length $in > length $string; + for( split //, substr $in, 0, (my $len = length $in) >> 1) { + my @range = ( my $str = my $end = $start .= $_ ); + ($str .= ++$end) && push @range, $end while $len > length $str; return \@range if $string eq $in; } return [$in]; diff --git a/challenge-116/james-smith/perl/ch-1.pl b/challenge-116/james-smith/perl/ch-1.pl index cdd0b29cc4..a43fcc2a65 100644 --- a/challenge-116/james-smith/perl/ch-1.pl +++ b/challenge-116/james-smith/perl/ch-1.pl @@ -11,6 +11,7 @@ my $ncomma = join ',',1..1000; my $lint_x = my $lint = ('9' x 999).'8'; my $lint_y = ++$lint_x; $lint_y++; + my @tests = ( [ 1234, '1,2,3,4' ], [ 91011, '9,10,11' ], @@ -31,7 +32,7 @@ done_testing(); sub splitnum { my( $in, $start ) = ( shift, '' ); - for( split //, substr $in, 0, (length $in) >> 1) { + for( split //, substr $in, 0, (my $len = length $in) >> 1) { ## $start contains the first number of sequence ## each time through the loop we will add the ## next digit eg 1, 12, 123 @@ -39,20 +40,19 @@ sub splitnum { ## $end contains a copy of this, which we will ## then incremement as we generate the sum - my @range = ( my $string = my $end = $start .= $_ ); + my @range = ( my $str = my $end = $start .= $_ ); ## We concatenate the of "end" onto $string until ## it is equal to or larger than the input number - ($string .= ++$end) && push @range, $end - while length $in > length $string; + ($str .= ++$end) && push @range, $end while $len > length $str; ## Finally we return the list if the input and ## string are the same. Note we will always get ## a true value as in the last loop ## $in == $start == $end == $string - return \@range if $string eq $in; + return \@range if $str eq $in; } return [$in]; } @@ -67,11 +67,11 @@ sub splitnum { ## Below is the code above with the comments removed sub splitnum_no_comments { - my( $in, $st ) = ( shift, '' ); - for( split //, substr $in, 0, (length $in) >> 1) { - my @r = ( my $t = my $en = $st .= $_ ); - ($t .= ++$en) && push @r,$en while length $in > length $t; - return \@r if $t eq $in; + my( $in, $start ) = ( shift, '' ); + for( split //, substr $in, 0, (my $len = length $in) >> 1) { + my @range = ( my $str = my $end = $start .= $_ ); + ($str .= ++$end) && push @range,$end while $len > length $str; + return \@range if $str eq $in; } return [$in]; } -- cgit From 5f7b533e8cf34449a3a92a91dadc67856a883660 Mon Sep 17 00:00:00 2001 From: Abigail Date: Mon, 7 Jun 2021 20:10:04 +0200 Subject: AWK, Bash, C, Lua, Node.js, Perl, Python, Ruby solutions for week 116, part 2. --- challenge-116/abigail/README.md | 8 ++++++ challenge-116/abigail/awk/ch-2.awk | 19 +++++++++++++ challenge-116/abigail/bash/ch-2.sh | 53 ++++++++++++++++++++++++++++++++++++ challenge-116/abigail/c/ch-2.c | 35 ++++++++++++++++++++++++ challenge-116/abigail/lua/ch-2.lua | 22 +++++++++++++++ challenge-116/abigail/node/ch-2.js | 26 ++++++++++++++++++ challenge-116/abigail/perl/ch-2.pl | 29 ++++++++++++++++++++ challenge-116/abigail/python/ch-2.py | 23 ++++++++++++++++ challenge-116/abigail/ruby/ch-2.rb | 21 ++++++++++++++ 9 files changed, 236 insertions(+) create mode 100644 challenge-116/abigail/awk/ch-2.awk create mode 100644 challenge-116/abigail/bash/ch-2.sh create mode 100644 challenge-116/abigail/c/ch-2.c create mode 100644 challenge-116/abigail/lua/ch-2.lua create mode 100644 challenge-116/abigail/node/ch-2.js create mode 100644 challenge-116/abigail/perl/ch-2.pl create mode 100644 challenge-116/abigail/python/ch-2.py create mode 100644 challenge-116/abigail/ruby/ch-2.rb diff --git a/challenge-116/abigail/README.md b/challenge-116/abigail/README.md index 629117cbfb..a68ef6430c 100644 --- a/challenge-116/abigail/README.md +++ b/challenge-116/abigail/README.md @@ -47,6 +47,14 @@ Output: 0 as 5^2 + 2^2 => 25 + 4 => 29 ~~~~ ### Solutions +* [AWK](awk/ch-2.awk) +* [Bash](bash/ch-2.sh) +* [C](c/ch-2.c) +* [Lua](lua/ch-2.lua) +* [Node.js](node/ch-2.js) +* [Perl](perl/ch-2.pl) +* [Python](python/ch-2.py) +* [Ruby](ruby/ch-2.rb) ### Blog [Sum of Squares](https://abigail.github.io/HTML/Perl-Weekly-Challenge/week-116-2.html) diff --git a/challenge-116/abigail/awk/ch-2.awk b/challenge-116/abigail/awk/ch-2.awk new file mode 100644 index 0000000000..6353b61eb8 --- /dev/null +++ b/challenge-116/abigail/awk/ch-2.awk @@ -0,0 +1,19 @@ +#!/usr/bin/awk + +# +# See ../README.md +# + +# +# Run as: awk -f ch-2.awk < input-file +# + +{ + sum_of_squares = 0 + for (i = 1; i <= length ($1); i ++) { + # Sum of squares + sum_of_squares += substr ($1, i, 1) * substr ($1, i, 1) + } + root = int (.5 + int (sqrt (sum_of_squares))) + print (sum_of_squares == root * root ? 1 : 0) +} diff --git a/challenge-116/abigail/bash/ch-2.sh b/challenge-116/abigail/bash/ch-2.sh new file mode 100644 index 0000000000..8d0f9fe95d --- /dev/null +++ b/challenge-116/abigail/bash/ch-2.sh @@ -0,0 +1,53 @@ +#!/bin/sh + +# +# See ../README.md +# + +# +# Run as: bash ch-2.sh < input-file +# + +set -f + +while read line +do # + # Calculate the sum of the squares of the digits. We'll ignore + # any character which isn't a digit, and we ignore 0 as well + # (as it won't contribute anything to the sum) + # + ((sum_of_squares = 0)) + for ((i = 0; i < ${#line}; i ++)) + do char=${line:$i:1} + if test "0" "<" $char -a $char "<" ":" # 1 - 9 + then ((sum_of_squares += char * char)) + fi + done + + # + # Find a smallest power of two whose square is larger than sum-of-squares + # + root_upper=1 + while ((root_upper * root_upper < sum_of_squares)) + do ((root_upper = root_upper * 2)) + done + + # + # Use binary search to zoom into the square of sum-of-squares. + # + ((root_lower = root_upper / 2)) + ((out = 0)) + while ((root_lower < root_upper)) + do ((root_mid = (root_upper + root_lower) / 2)) + ((square_mid = root_mid * root_mid)) + if ((square_mid == sum_of_squares)) + then ((out = 1)) + ((root_lower = root_upper)) + else if ((square_mid < sum_of_squares)) + then ((root_lower = root_mid + 1)) + else ((root_upper = root_mid)) + fi + fi + done + echo $out +done diff --git a/challenge-116/abigail/c/ch-2.c b/challenge-116/abigail/c/ch-2.c new file mode 100644 index 0000000000..ef0b8bd20a --- /dev/null +++ b/challenge-116/abigail/c/ch-2.c @@ -0,0 +1,35 @@ +# include +# include +# include +# include +# include + +/* + * See ../README.md + */ + +/* + * Run as: cc -o ch-2.o ch-2.c; ./ch-2.o < input-file + */ + +int main (void) { + char * line = NULL; + size_t len = 0; + size_t str_len; + + while ((str_len = getline (&line, &len, stdin)) != -1) { + char * line_ptr = line; + long sum_of_squares = 0; + while (* line_ptr) { + if (isdigit (* line_ptr)) { + sum_of_squares += (* line_ptr - '0') * (* line_ptr - '0'); + } + line_ptr ++; + } + long root = (long) floor (.5 + sqrt (sum_of_squares)); + printf ("%d\n", sum_of_squares == root * root ? 1 : 0); + } + free (line); + + return (0); +} diff --git a/challenge-116/abigail/lua/ch-2.lua b/challenge-116/abigail/lua/ch-2.lua new file mode 100644 index 0000000000..f53ea72076 --- /dev/null +++ b/challenge-116/abigail/lua/ch-2.lua @@ -0,0 +1,22 @@ +#!/opt/local/bin/lua + +-- +-- See ../README.md +-- + +-- +-- Run as: lua ch-2.lua < input-file +-- + +for line in io . lines () do + local sum_of_squares = 0 + for d in line : gmatch ("%d") do + local number = tonumber (d) + sum_of_squares = sum_of_squares + number * number + end + root = math . floor (.5 + math . sqrt (sum_of_squares)) + if sum_of_squares == root * root + then print (1) + else print (0) + end +end diff --git a/challenge-116/abigail/node/ch-2.js b/challenge-116/abigail/node/ch-2.js new file mode 100644 index 0000000000..c11aa92ad4 --- /dev/null +++ b/challenge-116/abigail/node/ch-2.js @@ -0,0 +1,26 @@ +#!/usr/local/bin/node + +// +// See ../README.md +// + +// +// Run as: node ch-2.js < input-file +// + +require ('readline') +. createInterface ({input: process . stdin}) +. on ('line', _ => console . log (squares_sum_to_square (_))) +; + + +function squares_sum_to_square (line) { + let sum_of_squares = 0 + line . split ('') . forEach (letter => { + if ("0" <= letter && letter <= "9") { + sum_of_squares += + letter * + letter + } + }) + let root = Math . floor (.5 + Math . sqrt (sum_of_squares)) + return (sum_of_squares == root * root ? 1 : 0) +} diff --git a/challenge-116/abigail/perl/ch-2.pl b/challenge-116/abigail/perl/ch-2.pl new file mode 100644 index 0000000000..6e3f826663 --- /dev/null +++ b/challenge-116/abigail/perl/ch-2.pl @@ -0,0 +1,29 @@ +#!/opt/perl/bin/perl + +use 5.032; + +use strict; +use warnings; +no warnings 'syntax'; + +use experimental 'signatures'; +use experimental 'lexical_subs'; + +# +# See ../README.md +# + +# +# Run as: perl ch-2.pl < input-file +# +use List::Util qw [sum]; + +# +# Print 1 if the squares of the digits sum to a perfect square, 0 otherwise. +# +while (<>) { + # Calculate the sum of the squares of the digits. + my $sum_of_squares = sum map {$_ * $_} /[1-9]/g; # Ignore 0s + # Is it a perfect square? (Take care of rounding errors). + say $sum_of_squares == int (.5 + sqrt $sum_of_squares) ** 2 ? 1 : 0 +} diff --git a/challenge-116/abigail/python/ch-2.py b/challenge-116/abigail/python/ch-2.py new file mode 100644 index 0000000000..0876b16b64 --- /dev/null +++ b/challenge-116/abigail/python/ch-2.py @@ -0,0 +1,23 @@ +#!/opt/local/bin/python + +# +# See ../README.md +# + +# +# Run as: python ch-2.py < input-file +# + +import fileinput +from math import sqrt + +for line in fileinput . input (): + sum_of_squares = 0 + for char in line: + if "1" <= char and char <= "9": + sum_of_squares = sum_of_squares + int (char) * int (char) + root = int (.5 + sqrt (sum_of_squares)) + if sum_of_squares == root * root: + print (1) + else: + print (0) diff --git a/challenge-116/abigail/ruby/ch-2.rb b/challenge-116/abigail/ruby/ch-2.rb new file mode 100644 index 0000000000..5dce7242cc --- /dev/null +++ b/challenge-116/abigail/ruby/ch-2.rb @@ -0,0 +1,21 @@ +#!/usr/bin/ruby + +# +# See ../README.md +# + +# +# Run as: ruby ch-2.rb < input-file +# + +ARGF . each_line do + |line| + sum_of_squares = 0 + line . split('') . each do + |char| + if "1" <= char && char <= "9" + then sum_of_squares += (char . to_i) ** 2 + end + end + puts (sum_of_squares == (Math . sqrt (sum_of_squares) . round) ** 2 ? 1 : 0) +end -- cgit From c478146919171ba531d7e7c7978e53672ea0b15b Mon Sep 17 00:00:00 2001 From: Tyler Wardhaugh Date: Tue, 8 Jun 2021 08:23:40 -0700 Subject: Ch116: prep for challenge --- .../tyler-wardhaugh/clojure/src/tw/weekly/c116/core.clj | 12 ++++++++++++ .../tyler-wardhaugh/clojure/src/tw/weekly/c116/t1.clj | 14 ++++++++++++++ .../tyler-wardhaugh/clojure/src/tw/weekly/c116/t2.clj | 14 ++++++++++++++ .../tyler-wardhaugh/clojure/test/tw/weekly/c116_test.clj | 16 ++++++++++++++++ 4 files changed, 56 insertions(+) create mode 100644 challenge-116/tyler-wardhaugh/clojure/src/tw/weekly/c116/core.clj create mode 100644 challenge-116/tyler-wardhaugh/clojure/src/tw/weekly/c116/t1.clj create mode 100644 challenge-116/tyler-wardhaugh/clojure/src/tw/weekly/c116/t2.clj create mode 100644 challenge-116/tyler-wardhaugh/clojure/test/tw/weekly/c116_test.clj diff --git a/challenge-116/tyler-wardhaugh/clojure/src/tw/weekly/c116/core.clj b/challenge-116/tyler-wardhaugh/clojure/src/tw/weekly/c116/core.clj new file mode 100644 index 0000000000..3b07896606 --- /dev/null +++ b/challenge-116/tyler-wardhaugh/clojure/src/tw/weekly/c116/core.clj @@ -0,0 +1,12 @@ +(ns tw.weekly.c116.core + (:require [tw.weekly.c116.t1 :as t1]) + (:require [tw.weekly.c116.t2 :as t2]) + (:gen-class)) + +(defn -main + "Run all tasks" + [& _] + (println "Task #1:") + (t1/-main) + (println "\nTask #2:") + (t2/-main)) diff --git a/challenge-116/tyler-wardhaugh/clojure/src/tw/weekly/c116/t1.clj b/challenge-116/tyler-wardhaugh/clojure/src/tw/weekly/c116/t1.clj new file mode 100644 index 0000000000..050318ad50 --- /dev/null +++ b/challenge-116/tyler-wardhaugh/clojure/src/tw/weekly/c116/t1.clj @@ -0,0 +1,14 @@ +(ns tw.weekly.c116.t1 + (:require [clojure.edn :as edn])) + +;;; +; Task description for TASK #1 › Number Sequence +;;; +(def DEFAULT-INPUT [1234]) + +(defn -main + "Run Task 1 with a given input N, defaulting to the first example from the + task description." + [& args] + (let [[N] (or (some->> args (map edn/read-string)) DEFAULT-INPUT)] + )) diff --git a/challenge-116/tyler-wardhaugh/clojure/src/tw/weekly/c116/t2.clj b/challenge-116/tyler-wardhaugh/clojure/src/tw/weekly/c116/t2.clj new file mode 100644 index 0000000000..2252023c1d --- /dev/null +++ b/challenge-116/tyler-wardhaugh/clojure/src/tw/weekly/c116/t2.clj @@ -0,0 +1,14 @@ +(ns tw.weekly.c116.t2 + (:require [clojure.edn :as edn])) + +;;; +; Task description for TASK #2 › Sum of Squares +;;; +(def DEFAULT-INPUT [34]) + +(defn -main + "Run Task 2 with a given input N, defaulting to the first example from the + task description." + [& args] + (let [[N] (or (some->> args (map edn/read-string)) DEFAULT-INPUT)] + )) diff --git a/challenge-116/tyler-wardhaugh/clojure/test/tw/weekly/c116_test.clj b/challenge-116/tyler-wardhaugh/clojure/test/tw/weekly/c116_test.clj new file mode 100644 index 0000000000..cc45e92657 --- /dev/null +++ b/challenge-116/tyler-wardhaugh/clojure/test/tw/weekly/c116_test.clj @@ -0,0 +1,16 @@ +(ns tw.weekly.c116-test + (:require [clojure.test :refer [deftest is testing]] + #_[tw.weekly.c116.t1 :refer []] + #_[tw.weekly.c116.t2 :refer []])) + +#_(deftest task-1 + (testing "Task 1, Number Sequence" + (is ) + (is ) + (is ))) + +#_(deftest task-2 + (testing "Task 2, Sum of Squares" + (is ) + (is ) + (is ))) -- cgit From 9e897207c8fd266fca458e65ecf2bb32c09ec180 Mon Sep 17 00:00:00 2001 From: Abigail Date: Tue, 8 Jun 2021 18:10:16 +0200 Subject: Implement four different ways to check whether a number is perfect square. For the perl solution of week 116, part 2. --- challenge-116/abigail/perl/ch-2.pl | 83 ++++++++++++++++++++++++++++++++++++-- challenge-116/abigail/t/ctest.ini | 3 ++ 2 files changed, 83 insertions(+), 3 deletions(-) diff --git a/challenge-116/abigail/perl/ch-2.pl b/challenge-116/abigail/perl/ch-2.pl index 6e3f826663..387d5f3afd 100644 --- a/challenge-116/abigail/perl/ch-2.pl +++ b/challenge-116/abigail/perl/ch-2.pl @@ -14,16 +14,93 @@ use experimental 'lexical_subs'; # # -# Run as: perl ch-2.pl < input-file +# Run as: perl ch-2.pl [sqrt | count | search | preproces ] < input-file +# +# We will be using one of four different ways to check whether the sum +# of the squares is a square: +# +# - sqrt: Use sqrt () to get the square root of the sum of squares; +# we round this to an integer and square it, and check whether +# we have the same number. This is the fastest way, but it +# requires us to deal with floating point numbers and rounding +# errors. (This will be the default if no argument is given). +# - count: We'll start counting from 1, and square the numbers. +# If at one point the square equals the sum of squares, +# we have success. If we exceed the sum of squares without +# hitting it, the sum of squares isn't a perfect square. +# This sounds inefficient, but the sum of squares is at +# most 81 * N, where N indicates the number of input digits. +# This means we at most have to check 9 * sqrt (N) numbers, +# so its running time is O (sqrt (N)), which is far less +# than calculating the sum of squares, which is O (N). +# - search: First use a doubling method to find a number X such that +# X * X is greater than the sum of squares. Then use binary +# search to find out whether the sum of squares is a square. +# The running time will be O (log sqrt (N)), also far less +# than calculating the sum of squares. +# - preprocess: Calculate the first 9000 squares. Then we can do an O (1) +# lookup. 9000 squares will work for all numbers up to one +# million digits (and for many, many, more numbers). # use List::Util qw [sum]; +my $TYPE_SQRT = 0; +my $TYPE_COUNT = 1; +my $TYPE_SEARCH = 2; +my $TYPE_PREPROCESS = 3; + +my $type = $TYPE_SQRT; +if (@ARGV) { + my $arg = shift; + if ($arg eq 'count') {$type = $TYPE_COUNT} + if ($arg eq 'search') {$type = $TYPE_SEARCH} + if ($arg eq 'preprocess') {$type = $TYPE_PREPROCESS} +} + +my %squares; +%squares = map {$_ * $_ => 1} 1 .. 9000; + # # Print 1 if the squares of the digits sum to a perfect square, 0 otherwise. # while (<>) { + # # Calculate the sum of the squares of the digits. + # my $sum_of_squares = sum map {$_ * $_} /[1-9]/g; # Ignore 0s - # Is it a perfect square? (Take care of rounding errors). - say $sum_of_squares == int (.5 + sqrt $sum_of_squares) ** 2 ? 1 : 0 + + my $is_square; + if ($type == $TYPE_SQRT) { + # Is it a perfect square? (Take care of rounding errors). + $is_square = $sum_of_squares == int (.5 + sqrt $sum_of_squares) ** 2; + } + if ($type == $TYPE_COUNT) { + my $root = 0; + $root ++ while $root * $root < $sum_of_squares; + $is_square = $sum_of_squares == $root * $root; + } + if ($type == $TYPE_SEARCH) { + my $root_min = 0; + my $root_max = 1; + $root_max *= 2 while $root_max * $root_max < $sum_of_squares; + while ($root_min < $root_max) { + my $root_mid = int (($root_min + $root_max) / 2); + my $square_mid = $root_mid * $root_mid; + if ($square_mid == $sum_of_squares) { + $is_square = 1; + last; + } + if ($square_mid < $sum_of_squares) { + $root_min = $root_mid + 1; + } + else { + $root_max = $root_mid; + } + } + } + if ($type == $TYPE_PREPROCESS) { + $is_square = $squares {$sum_of_squares}; + } + + say $is_square ? 1 : 0; } diff --git a/challenge-116/abigail/t/ctest.ini b/challenge-116/abigail/t/ctest.ini index 527781acbb..f69d940551 100644 --- a/challenge-116/abigail/t/ctest.ini +++ b/challenge-116/abigail/t/ctest.ini @@ -6,3 +6,6 @@ [names] 1-1 = Given Examples 2-1 = Given Examples + +[challenges/2/perl] +run_types = sqrt, count, search, preprocess -- cgit From ef7ce9bd5bf986bd4f2d99e082013e5f895f0d9e Mon Sep 17 00:00:00 2001 From: Abigail Date: Tue, 8 Jun 2021 18:28:20 +0200 Subject: Tests with large numbers. Week 116, part 2 --- challenge-116/abigail/t/ctest.ini | 1 + challenge-116/abigail/t/input-2-2 | 3 +++ challenge-116/abigail/t/output-2-2.exp | 3 +++ 3 files changed, 7 insertions(+) create mode 100644 challenge-116/abigail/t/input-2-2 create mode 100644 challenge-116/abigail/t/output-2-2.exp diff --git a/challenge-116/abigail/t/ctest.ini b/challenge-116/abigail/t/ctest.ini index f69d940551..6e4daf9ab7 100644 --- a/challenge-116/abigail/t/ctest.ini +++ b/challenge-116/abigail/t/ctest.ini @@ -6,6 +6,7 @@ [names] 1-1 = Given Examples 2-1 = Given Examples +2-2 = Large Numbers [challenges/2/perl] run_types = sqrt, count, search, preprocess diff --git a/challenge-116/abigail/t/input-2-2 b/challenge-116/abigail/t/input-2-2 new file mode 100644 index 0000000000..44be9e6e8f --- /dev/null +++ b/challenge-116/abigail/t/input-2-2 @@ -0,0 +1,3 @@ +999999999999999999999999999999999964111 +999994999999999199919999999991999969999 +999999999999999999999999999999999964112 diff --git a/challenge-116/abigail/t/output-2-2.exp b/challenge-116/abigail/t/output-2-2.exp new file mode 100644 index 0000000000..2f1465d159 --- /dev/null +++ b/challenge-116/abigail/t/output-2-2.exp @@ -0,0 +1,3 @@ +1 +1 +0 -- cgit From d26784f3824077ef37b82dfe08d45cc058b1eeb1 Mon Sep 17 00:00:00 2001 From: Dave Jacoby Date: Tue, 8 Jun 2021 16:45:43 -0400 Subject: Challenge 116 --- challenge-116/dave-jacoby/blog.txt | 1 + challenge-116/dave-jacoby/perl/ch-1.pl | 60 ++++++++++++++++++++++++++++++++++ challenge-116/dave-jacoby/perl/ch-2.pl | 21 ++++++++++++ 3 files changed, 82 insertions(+) create mode 100644 challenge-116/dave-jacoby/blog.txt create mode 100644 challenge-116/dave-jacoby/perl/ch-1.pl create mode 100644 challenge-116/dave-jacoby/perl/ch-2.pl diff --git a/challenge-116/dave-jacoby/blog.txt b/challenge-116/dave-jacoby/blog.txt new file mode 100644 index 0000000000..ee2ac92999 --- /dev/null +++ b/challenge-116/dave-jacoby/blog.txt @@ -0,0 +1 @@ +https://jacoby.github.io/2021/06/08/hip-to-be-square-perl-weekly-challenge-116.html \ No newline at end of file diff --git a/challenge-116/dave-jacoby/perl/ch-1.pl b/challenge-116/dave-jacoby/perl/ch-1.pl new file mode 100644 index 0000000000..de98873f64 --- /dev/null +++ b/challenge-116/dave-jacoby/perl/ch-1.pl @@ -0,0 +1,60 @@ +#!/usr/bin/env perl + +use strict; +use warnings; +use feature qw{ postderef say signatures state }; +no warnings qw{ experimental }; + +my @numbers = qw{ 1234 91011 10203 }; + +for my $n (@numbers) { + say base($n); +} + +# we are asked to return the sequence +# or the given number, and accounting +# for that makes recursion difficult, +# so we pass to base to determine that + +sub base ( $n ) { + my $s = get_sequence($n); + return $s//$n; +} + +# test for success and return if successful +# then add commas within (a copy of) the +# string + +sub get_sequence ( $n ) { + my $t = test($n); + return $n if $t; + + my $output; + my @n = split /,/, $n; + my $flag = 0; + map { $flag += 1 if $_ > 10 } @n; + if ( $flag > 0 ) { + for my $i ( 0 .. length $n ) { + my $cp = $n; + my $l = substr( $cp, $i, 1 ); + substr( $cp, $i, 1 ) = ',' . $l; + next if $cp =~ m{^\,|\,\,|\,$}; + my $x = get_sequence($cp); + return $x if $x; + } + } + return undef; +} + +sub test ( $n ) { + my $t = 1; + my @n = split /,/, $n; + $t = 0 if $n[0] =~ m{^0}mx; + $t = 0 if scalar @n < 2; + for my $i ( 1 .. -1 + scalar @n ) { + my $h = $i - 1; + $t = 0 if $n[$i] =~ m{^0}mx; + $t = 0 unless $n[$h] + 1 == $n[$i]; + } + return $t; +} diff --git a/challenge-116/dave-jacoby/perl/ch-2.pl b/challenge-116/dave-jacoby/perl/ch-2.pl new file mode 100644 index 0000000000..af368b69ca --- /dev/null +++ b/challenge-116/dave-jacoby/perl/ch-2.pl @@ -0,0 +1,21 @@ +#!/usr/bin/env perl + +use strict; +use warnings; +use feature qw{ postderef say signatures state }; +no warnings qw{ experimental }; + +use List::Util qw{sum0}; + +my @numbers = sort (34, 50, 52, 10 ); + +for my $n ( @numbers ) { + my $b = sum_of_squares($n); + say join "\t", $n,$b?'Yes':'No'; +} + +sub sum_of_squares ( $n ) { + my $sum = sum0 map { $_ ** 2 } split //, $n; + my $root = sqrt $sum; + return int $root == $root ? 1 : 0 ; +} \ No newline at end of file -- cgit From e9613acddf65993abb1c7d6e0d3003b5d2642cbf Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Wed, 9 Jun 2021 10:01:13 +0100 Subject: - Added solutions by Cheok-Yin Fung. --- stats/pwc-current.json | 159 +++--- stats/pwc-language-breakdown-summary.json | 66 +-- stats/pwc-language-breakdown.json | 858 +++++++++++++++--------------- stats/pwc-leaders.json | 428 +++++++-------- stats/pwc-summary-1-30.json | 98 ++-- stats/pwc-summary-121-150.json | 120 ++--- stats/pwc-summary-151-180.json | 110 ++-- stats/pwc-summary-181-210.json | 104 ++-- stats/pwc-summary-211-240.json | 44 +- stats/pwc-summary-31-60.json | 34 +- stats/pwc-summary-61-90.json | 42 +- stats/pwc-summary-91-120.json | 98 ++-- stats/pwc-summary.json | 48 +- 13 files changed, 1112 insertions(+), 1097 deletions(-) diff --git a/stats/pwc-current.json b/stats/pwc-current.json index b5d280035a..948d5058a2 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -1,10 +1,25 @@ { - "chart" : { - "type" : "column" + "plotOptions" : { + "series" : { + "borderWidth" : 0, + "dataLabels" : { + "enabled" : 1, + "format" : "{point.y}" + } + } + }, + "subtitle" : { + "text" : "[Champions: 13] Last updated at 2021-06-09 09:00:21 GMT" + }, + "tooltip" : { + "pointFormat" : "{point.name}: {point.y:f}
", + "headerFormat" : "{series.name}
", + "followPointer" : 1 }, "drilldown" : { "series" : [ { + "id" : "Aaron Smith", "name" : "Aaron Smith", "data" : [ [ @@ -15,8 +30,17 @@ "Blog", 1 ] + ] + }, + { + "data" : [ + [ + "Perl", + 2 + ] ], - "id" : "Aaron Smith" + "id" : "Cheok-Yin Fung", + "name" : "Cheok-Yin Fung" }, { "data" : [ @@ -29,6 +53,8 @@ "name" : "E. Choroba" }, { + "name" : "Flavio Poletti", + "id" : "Flavio Poletti", "data" : [ [ "Perl", @@ -42,12 +68,9 @@ "Blog", 2 ] - ], - "id" : "Flavio Poletti", - "name" : "Flavio Poletti" + ] }, { - "name" : "James Smith", "data" : [ [ "Perl", @@ -58,11 +81,10 @@ 1 ] ], - "id" : "James Smith" + "id" : "James Smith", + "name" : "James Smith" }, { - "name" : "Luca Ferrari", - "id" : "Luca Ferrari", "data" : [ [ "Raku", @@ -72,21 +94,23 @@ "Blog", 2 ] - ] + ], + "name" : "Luca Ferrari", + "id" : "Luca Ferrari" }, { "name" : "Mark Anderson", + "id" : "Mark Anderson", "data" : [ [ "Raku", 2 ] - ], - "id" : "Mark Anderson" + ] }, { - "name" : "Niels van Dijke", "id" : "Niels van Dijke", + "name" : "Niels van Dijke", "data" : [ [ "Perl", @@ -95,8 +119,8 @@ ] }, { - "name" : "Paulo Custodio", "id" : "Paulo Custodio", + "name" : "Paulo Custodio", "data" : [ [ "Perl", @@ -105,7 +129,6 @@ ] }, { - "name" : "Roger Bell_West", "data" : [ [ "Perl", @@ -116,10 +139,10 @@ 2 ] ], - "id" : "Roger Bell_West" + "id" : "Roger Bell_West", + "name" : "Roger Bell_West" }, { - "name" : "Simon Green", "data" : [ [ "Perl", @@ -130,7 +153,8 @@ 1 ] ], - "id" : "Simon Green" + "id" : "Simon Green", + "name" : "Simon Green" }, { "name" : "Simon Proctor", @@ -143,7 +167,6 @@ ] }, { - "name" : "Stuart Little", "data" : [ [ "Perl", @@ -154,55 +177,28 @@ 2 ] ], + "name" : "Stuart Little", "id" : "Stuart Little" } ] }, - "plotOptions" : { - "series" : { - "dataLabels" : { - "enabled" : 1, - "format" : "{point.y}" - }, - "borderWidth" : 0 - } - }, - "tooltip" : { - "headerFormat" : "{series.name}
", - "followPointer" : 1, - "pointFormat" : "{point.name}: {point.y:f}
" - }, - "xAxis" : { - "type" : "category" - }, - "yAxis" : { - "title" : { - "text" : "Total Solutions" - } - }, - "subtitle" : { - "text" : "[Champions: 12] Last updated at 2021-06-08 16:57:16 GMT" - }, - "legend" : { - "enabled" : 0 - }, - "title" : { - "text" : "Perl Weekly Challenge - 116" - }, "series" : [ { - "name" : "Perl Weekly Challenge - 116", - "colorByPoint" : 1, "data" : [ { "drilldown" : "Aaron Smith", - "y" : 3, - "name" : "Aaron Smith" + "name" : "Aaron Smith", + "y" : 3 }, { "y" : 2, + "drilldown" : "Cheok-Yin Fung", + "name" : "Cheok-Yin Fung" + }, + { + "drilldown" : "E. Choroba", "name" : "E. Choroba", - "drilldown" : "E. Choroba" + "y" : 2 }, { "drilldown" : "Flavio Poletti", @@ -210,34 +206,34 @@ "name" : "Flavio Poletti" }, { - "name" : "James Smith", + "drilldown" : "James Smith", "y" : 3, - "drilldown" : "James Smith" + "name" : "James Smith" }, { "drilldown" : "Luca Ferrari", - "name" : "Luca Ferrari", - "y" : 4 + "y" : 4, + "name" : "Luca Ferrari" }, { - "y" : 2, "name" : "Mark Anderson", - "drilldown" : "Mark Anderson" + "drilldown" : "Mark Anderson", + "y" : 2 }, { "name" : "Niels van Dijke", - "y" : 2, - "drilldown" : "Niels van Dijke" + "drilldown" : "Niels van Dijke", + "y" : 2 }, { + "name" : "Paulo Custodio", "drilldown" : "Paulo Custodio", - "y" : 2, - "name" : "Paulo Custodio" + "y" : 2 }, { "name" : "Roger Bell_West", - "y" : 4, - "drilldown" : "Roger Bell_West" + "drilldown" : "Roger Bell_West", + "y" : 4 }, { "drilldown" : "Simon Green", @@ -246,15 +242,34 @@ }, { "name" : "Simon Proctor", - "y" : 2, - "drilldown" : "Simon Proctor" + "drilldown" : "Simon Proctor", + "y" : 2 }, { "drilldown" : "Stuart Little", "name" : "Stuart Little", "y" : 4 } - ] + ], + "colorByPoint" : 1, + "name" : "Perl Weekly Challenge - 116" } - ] + ], + "title" : { + "text" : "Perl Weekly Challenge - 116" + }, + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } + }, + "chart" : { + "type" : "column" + }, + "legend" : { + "enabled" : 0 + }, + "xAxis" : { + "type" : "category" + } } diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json index b0d9b686ff..4b8cbd14c9 100644 --- a/stats/pwc-language-breakdown-summary.json +++ b/stats/pwc-language-breakdown-summary.json @@ -1,48 +1,30 @@ { - "chart" : { - "type" : "column" - }, - "yAxis" : { - "title" : { - "text" : null - }, - "min" : 0 - }, "xAxis" : { - "type" : "category", "labels" : { "style" : { - "fontSize" : "13px", - "fontFamily" : "Verdana, sans-serif" + "fontFamily" : "Verdana, sans-serif", + "fontSize" : "13px" } - } - }, - "subtitle" : { - "text" : "Last updated at 2021-06-08 16:57:15 GMT" + }, + "type" : "category" }, - "tooltip" : { - "pointFormat" : "{point.y:.0f}" + "chart" : { + "type" : "column" }, "legend" : { "enabled" : "false" }, + "yAxis" : { + "min" : 0, + "title" : { + "text" : null + } + }, "title" : { "text" : "Perl Weekly Challenge Contributions [2019 - 2020]" }, "series" : [ { - "dataLabels" : { - "format" : "{point.y:.0f}", - "rotation" : -90, - "style" : { - "fontSize" : "13px", - "fontFamily" : "Verdana, sans-serif" - }, - "color" : "#FFFFFF", - "y" : 10, - "enabled" : "true", - "align" : "right" - }, "data" : [ [ "Blog", @@ -50,14 +32,32 @@ ], [ "Perl", - 5472 + 5474 ], [ "Raku", 3476 ] ], - "name" : "Contributions" + "name" : "Contributions", + "dataLabels" : { + "rotation" : -90, + "color" : "#FFFFFF", + "y" : 10, + "format" : "{point.y:.0f}", + "align" : "right", + "style" : { + "fontSize" : "13px", + "fontFamily" : "Verdana, sans-serif" + }, + "enabled" : "true" + } } - ] + ], + "tooltip" : { + "pointFormat" : "{point.y:.0f}" + }, + "subtitle" : { + "text" : "Last updated at 2021-06-09 09:00:21 GMT" + } } diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json index 06d31055a1..dd18bf4fe4 100644 --- a/stats/pwc-language-breakdown.json +++ b/stats/pwc-language-breakdown.json @@ -1,35 +1,23 @@ { - "plotOptions" : { - "series" : { - "borderWidth" : 0, - "dataLabels" : { - "enabled" : 1, - "format" : "{point.y}" - } - } + "chart" : { + "type" : "column" + }, + "legend" : { + "enabled" : "false" }, "yAxis" : { "title" : { "text" : "Total Solutions" } }, - "subtitle" : { - "text" : "Click the columns to drilldown the language breakdown. Last updated at 2021-06-08 16:57:16 GMT" - }, - "xAxis" : { - "type" : "category" - }, - "tooltip" : { - "headerFormat" : "", - "followPointer" : "true", - "pointFormat" : "Challenge {point.name}: {point.y:f}
" - }, - "chart" : { - "type" : "column" + "title" : { + "text" : "Perl Weekly Challenge Language" }, "drilldown" : { "series" : [ { + "name" : "001", + "id" : "001", "data" : [ [ "Perl", @@ -43,9 +31,7 @@ "Blog", 11 ] - ], - "id" : "001", - "name" : "001" + ] }, { "name" : "002", @@ -66,8 +52,6 @@ ] }, { - "name" : "003", - "id" : "003", "data" : [ [ "Perl", @@ -81,9 +65,13 @@ "Blog", 9 ] - ] + ], + "name" : "003", + "id" : "003" }, { + "id" : "004", + "name" : "004", "data" : [ [ "Perl", @@ -97,13 +85,9 @@ "Blog", 10 ] - ], - "id" : "004", - "name" : "004" + ] }, { - "name" : "005", - "id" : "005", "data" : [ [ "Perl", @@ -117,7 +101,9 @@ "Blog", 12 ] - ] + ], + "name" : "005", + "id" : "005" }, { "name" : "006", @@ -138,6 +124,7 @@ ] }, { + "name" : "007", "id" : "007", "data" : [ [ @@ -152,8 +139,7 @@ "Blog", 10 ] - ], - "name" : "007" + ] }, { "name" : "008", @@ -174,6 +160,8 @@ ] }, { + "id" : "009", + "name" : "009", "data" : [ [ "Perl", @@ -187,12 +175,9 @@ "Blog", 13 ] - ], - "id" : "009", - "name" : "009" + ] }, { - "name" : "010", "data" : [ [ "Perl", @@ -207,9 +192,12 @@ 11 ] ], + "name" : "010", "id" : "010" }, { + "id" : "011", + "name" : "011", "data" : [ [ "Perl", @@ -223,13 +211,11 @@ "Blog", 10 ] - ], - "id" : "011", - "name" : "011" + ] }, { - "name" : "012", "id" : "012", + "name" : "012", "data" : [ [ "Perl", @@ -246,8 +232,6 @@ ] }, { - "name" : "013", - "id" : "013", "data" : [ [ "Perl", @@ -261,9 +245,12 @@ "Blog", 13 ] - ] + ], + "name" : "013", + "id" : "013" }, { + "id" : "014", "name" : "014", "data" : [ [ @@ -278,11 +265,11 @@ "Blog", 15 ] - ], - "id" : "014" + ] }, { "id" : "015", + "name" : "015", "data" : [ [ "Perl", @@ -296,12 +283,9 @@ "Blog", 15 ] - ], - "name" : "015" + ] }, { - "name" : "016", - "id" : "016", "data" : [ [ "Perl", @@ -315,10 +299,11 @@ "Blog", 12 ] - ] + ], + "id" : "016", + "name" : "016" }, { - "id" : "017", "data" : [ [ "Perl", @@ -333,11 +318,10 @@ 12 ] ], - "name" : "017" + "name" : "017", + "id" : "017" }, { - "name" : "018", - "id" : "018", "data" : [ [ "Perl", @@ -351,11 +335,13 @@ "Blog", 14 ] - ] + ], + "id" : "018", + "name" : "018" }, { - "name" : "019", "id" : "019", + "name" : "019", "data" : [ [ "Perl", @@ -372,7 +358,6 @@ ] }, { - "name" : "020", "data" : [ [ "Perl", @@ -387,10 +372,10 @@ 13 ] ], + "name" : "020", "id" : "020" }, { - "id" : "021", "data" : [ [ "Perl", @@ -405,10 +390,10 @@ 10 ] ], + "id" : "021", "name" : "021" }, { - "name" : "022", "data" : [ [ "Perl", @@ -423,11 +408,10 @@ 10 ] ], - "id" : "022" + "id" : "022", + "name" : "022" }, { - "name" : "023", - "id" : "023", "data" : [ [ "Perl", @@ -441,10 +425,13 @@ "Blog", 12 ] - ] + ], + "name" : "023", + "id" : "023" }, { "id" : "024", + "name" : "024", "data" : [ [ "Perl", @@ -458,10 +445,10 @@ "Blog", 11 ] - ], - "name" : "024" + ] }, { + "id" : "025", "name" : "025", "data" : [ [ @@ -476,11 +463,9 @@ "Blog", 12 ] - ], - "id" : "025" + ] }, { - "id" : "026", "data" : [ [ "Perl", @@ -495,10 +480,10 @@ 10 ] ], - "name" : "026" + "name" : "026", + "id" : "026" }, { - "name" : "027", "data" : [ [ "Perl", @@ -513,9 +498,12 @@ 9 ] ], + "name" : "027", "id" : "027" }, { + "id" : "028", + "name" : "028", "data" : [ [ "Perl", @@ -529,12 +517,11 @@ "Blog", 9 ] - ], - "id" : "028", - "name" : "028" + ] }, { "name" : "029", + "id" : "029", "data" : [ [ "Perl", @@ -548,11 +535,9 @@ "Blog", 12 ] - ], - "id" : "029" + ] }, { - "id" : "030", "data" : [ [ "Perl", @@ -567,10 +552,10 @@ 10 ] ], - "name" : "030" + "name" : "030", + "id" : "030" }, { - "id" : "031", "data" : [ [ "Perl", @@ -585,11 +570,12 @@ 9 ] ], + "id" : "031", "name" : "031" }, { - "name" : "032", "id" : "032", + "name" : "032", "data" : [ [ "Perl", @@ -606,7 +592,6 @@ ] }, { - "id" : "033", "data" : [ [ "Perl", @@ -621,11 +606,12 @@ 10 ] ], - "name" : "033" + "name" : "033", + "id" : "033" }, { - "name" : "034", "id" : "034", + "name" : "034", "data" : [ [ "Perl", @@ -643,6 +629,7 @@ }, { "id" : "035", + "name" : "035", "data" : [ [ "Perl", @@ -656,8 +643,7 @@ "Blog", 9 ] - ], - "name" : "035" + ] }, { "data" : [ @@ -678,8 +664,8 @@ "name" : "036" }, { - "name" : "037", "id" : "037", + "name" : "037", "data" : [ [ "Perl", @@ -696,6 +682,8 @@ ] }, { + "name" : "038", + "id" : "038", "data" : [ [ "Perl", @@ -709,11 +697,11 @@ "Blog", 12 ] - ], - "id" : "038", - "name" : "038" + ] }, { + "name" : "039", + "id" : "039", "data" : [ [ "Perl", @@ -727,9 +715,7 @@ "Blog", 12 ] - ], - "id" : "039", - "name" : "039" + ] }, { "name" : "040", @@ -750,8 +736,8 @@ ] }, { - "name" : "041", "id" : "041", + "name" : "041", "data" : [ [ "Perl", @@ -768,7 +754,6 @@ ] }, { - "name" : "042", "data" : [ [ "Perl", @@ -783,10 +768,10 @@ 11 ] ], - "id" : "042" + "id" : "042", + "name" : "042" }, { - "id" : "043", "data" : [ [ "Perl", @@ -801,10 +786,10 @@ 11 ] ], - "name" : "043" + "name" : "043", + "id" : "043" }, { - "id" : "044", "data" : [ [ "Perl", @@ -819,9 +804,12 @@ 11 ] ], + "id" : "044", "name" : "044" }, { + "id" : "045", + "name" : "045", "data" : [ [ "Perl", @@ -835,12 +823,9 @@ "Blog", 11 ] - ], - "id" : "045", - "name" : "045" + ] }, { - "name" : "046", "data" : [ [ "Perl", @@ -855,10 +840,12 @@ 10 ] ], + "name" : "046", "id" : "046" }, { "name" : "047", + "id" : "047", "data" : [ [ "Perl", @@ -872,10 +859,11 @@ "Blog", 10 ] - ], - "id" : "047" + ] }, { + "id" : "048", + "name" : "048", "data" : [ [ "Perl", @@ -889,11 +877,10 @@ "Blog", 12 ] - ], - "id" : "048", - "name" : "048" + ] }, { + "name" : "049", "id" : "049", "data" : [ [ @@ -908,10 +895,10 @@ "Blog", 12 ] - ], - "name" : "049" + ] }, { + "name" : "050", "id" : "050", "data" : [ [ @@ -926,10 +913,10 @@ "Blog", 12 ] - ], - "name" : "050" + ] }, { + "name" : "051", "id" : "051", "data" : [ [ @@ -944,12 +931,11 @@ "Blog", 11 ] - ], - "name" : "051" + ] }, { - "name" : "052", "id" : "052", + "name" : "052", "data" : [ [ "Perl", @@ -966,8 +952,6 @@ ] }, { - "name" : "053", - "id" : "053", "data" : [ [ "Perl", @@ -981,9 +965,12 @@ "Blog", 15 ] - ] + ], + "name" : "053", + "id" : "053" }, { + "id" : "054", "name" : "054", "data" : [ [ @@ -998,10 +985,10 @@ "Blog", 18 ] - ], - "id" : "054" + ] }, { + "id" : "055", "name" : "055", "data" : [ [ @@ -1016,10 +1003,10 @@ "Blog", 14 ] - ], - "id" : "055" + ] }, { + "name" : "056", "id" : "056", "data" : [ [ @@ -1034,11 +1021,9 @@ "Blog", 16 ] - ], - "name" : "056" + ] }, { - "id" : "057", "data" : [ [ "Perl", @@ -1053,9 +1038,12 @@ 15 ] ], - "name" : "057" + "name" : "057", + "id" : "057" }, { + "name" : "058", + "id" : "058", "data" : [ [ "Perl", @@ -1069,12 +1057,9 @@ "Blog", 13 ] - ], - "id" : "058", - "name" : "058" + ] }, { - "id" : "059", "data" : [ [ "Perl", @@ -1089,7