diff options
| author | Dave Jacoby <jacoby.david@gmail.com> | 2021-10-11 18:23:25 -0400 |
|---|---|---|
| committer | Dave Jacoby <jacoby.david@gmail.com> | 2021-10-11 18:23:25 -0400 |
| commit | ff561e038f54883f733890eae88fc9b1bd92d8e4 (patch) | |
| tree | 00657bb31b4e8b70e726a150e504ea18dbf290f4 | |
| parent | e91720d5c5c6b1c4bbe0b925dd686baaeec485a5 (diff) | |
| parent | d1cc085e5d97d49b827aad79bd57a909caa4b0a1 (diff) | |
| download | perlweeklychallenge-club-ff561e038f54883f733890eae88fc9b1bd92d8e4.tar.gz perlweeklychallenge-club-ff561e038f54883f733890eae88fc9b1bd92d8e4.tar.bz2 perlweeklychallenge-club-ff561e038f54883f733890eae88fc9b1bd92d8e4.zip | |
Merge branch 'master' of https://github.com/manwar/perlweeklychallenge-club
32 files changed, 2320 insertions, 1724 deletions
diff --git a/challenge-134/andinus/README b/challenge-134/andinus/README index 93034423ed..1d5171cfa8 100644 --- a/challenge-134/andinus/README +++ b/challenge-134/andinus/README @@ -1,81 +1,40 @@ ━━━━━━━━━━━━━━━ - CHALLENGE 133 + CHALLENGE 134 Andinus ━━━━━━━━━━━━━━━ - 2021-10-04 + 2021-10-11 -Task 1 - Integer Square Root -════════════════════════════ +Task 1 - Pandigital Numbers +═══════════════════════════ - You are given a positive integer `$N'. + Write a script to generate first 5 Pandigital Numbers in base 10. - Write a script to calculate the integer square root of the given - number. + As per the [wikipedia], it says: - Please avoid using built-in function. Find out more about it [here]. - - ┌──── - │ Input: $N = 10 - │ Output: 3 - │ - │ Input: $N = 27 - │ Output: 5 - │ - │ Input: $N = 85 - │ Output: 9 - │ - │ Input: $N = 101 - │ Output: 10 - └──── + A pandigital number is an integer that in a given base has + among its significant digits each digit used in the base + at least once. -[here] <https://en.wikipedia.org/wiki/Integer_square_root> +[wikipedia] <https://en.wikipedia.org/wiki/Pandigital_number> Raku ──── • Program: <file:raku/ch-1.raku> - Initial estimate is set to `$n +> 1', then we loop infinitely until - previous 2 estimates are equal. - - ┌──── - │ my $x = $n +> 1; - │ loop { - │ given ($x + ($n / $x)) / 2 { - │ last if $x == $_; - │ $x = $_; - │ } - │ } - │ put $x; - └──── - - -C -─ - - • Program: <file:c/ch-1.c> - - `argv' holds the input & `argc' holds the number of inputs. The input - should be a single integer so `argc' should be equal to 2. After - checking for that, we check if valid value was passed. - - Loop until previous 2 estimates are equal. + Loop from 1023456789 (first Pandigital Number) and take if it contains + every digit in base 10. ┌──── - │ double x = num >> 1; - │ for (;;) { - │ double x_next = (x + (num / x)) / 2; - │ if (x == x_next) - │ break; - │ x = x_next; - │ } - │ printf("%f\n", x); + │ put gather for 1023456789 .. ∞ { + │ .take if .comb>>.Int.Set ≡ (0 .. 9).Set; + │ }[^5] └──── diff --git a/challenge-134/andinus/README.org b/challenge-134/andinus/README.org new file mode 100644 index 0000000000..dddda91b7f --- /dev/null +++ b/challenge-134/andinus/README.org @@ -0,0 +1,28 @@ +#+title: Challenge 134 +#+date: 2021-10-11 +#+html_link_up: ../ +#+export_file_name: index +#+options: toc:nil +#+setupfile: ~/.emacs.d/org-templates/level-2.org + +* Task 1 - Pandigital Numbers + +Write a script to generate first 5 Pandigital Numbers in base 10. + +As per the [[https://en.wikipedia.org/wiki/Pandigital_number][wikipedia]], it says: + +#+begin_quote +A pandigital number is an integer that in a given base has among its +significant digits each digit used in the base at least once. +#+end_quote + +** Raku + +Loop from 1023456789 (first Pandigital Number) and take if it contains +every digit in base 10. + +#+begin_src raku +put gather for 1023456789 .. ∞ { + .take if .comb>>.Int.Set ≡ (0 .. 9).Set; +}[^5] +#+end_src diff --git a/challenge-134/andinus/blog-1.txt b/challenge-134/andinus/blog-1.txt new file mode 100644 index 0000000000..559fff7b37 --- /dev/null +++ b/challenge-134/andinus/blog-1.txt @@ -0,0 +1 @@ +https://andinus.unfla.me/pwc/challenge-134/ diff --git a/challenge-134/andinus/raku/ch-1.raku b/challenge-134/andinus/raku/ch-1.raku new file mode 100644 index 0000000000..8380756076 --- /dev/null +++ b/challenge-134/andinus/raku/ch-1.raku @@ -0,0 +1,3 @@ +put gather for 1023456789 .. ∞ { + .take if .comb>>.Int.Set ≡ (0 .. 9).Set; +}[^5] diff --git a/challenge-134/roger-bell-west/perl/ch-1.pl b/challenge-134/roger-bell-west/perl/ch-1.pl new file mode 100755 index 0000000000..c085cd1060 --- /dev/null +++ b/challenge-134/roger-bell-west/perl/ch-1.pl @@ -0,0 +1,35 @@ +#! /usr/bin/perl + +use strict; +use warnings; + +use Test::More tests => 1; + +is_deeply(pandigital(10),[1023456789, 1023456798, 1023456879, 1023456897, 1023456978, 1023456987, 1023457689, 1023457698, 1023457869, 1023457896],'example 1'); + +use Algorithm::Permute; + +sub pandigital { + my $count=shift; + my $digits=1; + my $cc=1; + while ($cc<$count) { + $digits++; + $cc*=$digits; + if ($digits > 10) { + die "too large\n"; + } + } + my @template=(reverse (1,0,2..9)); + my @o; + my @lead=reverse splice @template,$digits; + my $p=Algorithm::Permute->new(\@template); + while (my @r=$p->next) { + push @o,join('',@r); + } + @o=sort @o; + splice @o,$count; + my $l=join('',@lead); + @o=map {"$l$_"} @o; + return \@o; +} diff --git a/challenge-134/roger-bell-west/perl/ch-2.pl b/challenge-134/roger-bell-west/perl/ch-2.pl new file mode 100755 index 0000000000..efb7c8bbe0 --- /dev/null +++ b/challenge-134/roger-bell-west/perl/ch-2.pl @@ -0,0 +1,56 @@ +#! /usr/bin/perl + +use strict; +use warnings; + +distinctterms(3,3); + +distinctterms(3,5); + +use List::Util qw(max sum); + +sub distinctterms { + my $m=shift; + my $n=shift; + my @r; + push @r,['x',(1..$n)]; + my %terms; + foreach my $mm (1..$m) { + my @q=($mm); + foreach my $nn (1..$n) { + my $p=$mm*$nn; + push @q,$p; + $terms{$p}=1; + } + push @r,\@q; + } + my @cw=(0,0); + foreach my $rr (@r) { + foreach my $ci (0..$#{$rr}) { + my $wi=$ci==0?0:1; + $cw[$wi]=max($cw[$wi],length($rr->[$ci])); + } + } + foreach my $ri (0..$#r) { + my @k; + if ($ri==0) { + push @k,sprintf('%'.$cw[0].'s',$r[$ri][0]); + } else { + push @k,sprintf('%'.$cw[0].'d',$r[$ri][0]); + } + push @k,'|'; + foreach my $ci (1..$#{$r[$ri]}) { + push @k,sprintf('%'.$cw[1].'d',$r[$ri][$ci]); + } + my $l=join(' ',@k); + print "$l\n"; + if ($ri==0) { + $l =~ s/[^|]/-/g; + $l =~ s/\|/+/g; + print "$l\n"; + } + } + print "\n"; + print "Distinct Terms: ".join(', ',sort {$a <=> $b} keys %terms)."\n"; + print "Count: ".(scalar keys %terms)."\n"; +} diff --git a/challenge-134/roger-bell-west/postscript/ch-2.ps b/challenge-134/roger-bell-west/postscript/ch-2.ps new file mode 100644 index 0000000000..5cd1cb56e6 --- /dev/null +++ b/challenge-134/roger-bell-west/postscript/ch-2.ps @@ -0,0 +1,96 @@ +%!PS + +/bubblesort { + mark exch aload pop counttomark /idx + exch store + { + 0 1 idx 1 sub { + pop 2 copy gt { + exch + } if idx 1 roll + } for + idx 1 roll /idx idx 1 sub store + idx 0 eq { + exit + } if + } loop +] +} store + +/strconcat % (a) (b) -> (ab) +{ exch dup length + 2 index length add string + dup dup 4 2 roll copy length + 4 -1 roll putinterval +} bind def + +/strjoin % [(a) (b) (c)] (j) -> ajbjc +{ + /j exch def + dup 0 get /out exch def + /first true def + { + first { + /first false def + } { + out j strconcat + exch strconcat + /out exch def + } ifelse + } forall + out +} def + + /apush { % [a b] c -> [a b c] + /t exch def + [ exch aload pop t ] + } def + + /multable { + /x exch def + /y exch def + /dscale 25 def + gsave 20 800 translate + /Times-Roman findfont 12 scalefont setfont + x y mul dict /results exch def + 0 0 6 sub moveto (x) show + 0 + 1 1 y { + /yy exch def + 0 yy dscale neg mul 6 sub moveto yy (...) cvs show + } for + 1 1 x { + /xx exch def + xx dscale mul 0 6 sub moveto xx (...) cvs show + 1 1 y { + /yy exch def + /res xx yy mul def + results res 1 put + xx dscale mul yy dscale neg mul 6 sub moveto res (...) cvs show + } for + } for + 0 0.5 dscale mul neg moveto + x 0.5 add dscale mul 0.5 dscale mul neg lineto + 0.5 dscale mul 0 moveto + 0.5 dscale mul y 0.5 add dscale mul neg lineto + stroke + /ra 0 array def + results { + pop + ra exch apush /ra exch def + } forall + ra bubblesort + /rb 0 array def + { + (..) cvs rb exch dup length string cvs apush /rb exch store + } forall + rb (, ) strjoin + 0 y 2 add dscale mul neg moveto + show + 0 y 3 add dscale mul neg moveto + ra length (..) cvs show + grestore + showpage + } def + 3 3 multable + 3 5 multable diff --git a/challenge-134/roger-bell-west/python/ch-1.py b/challenge-134/roger-bell-west/python/ch-1.py new file mode 100755 index 0000000000..df16a2ea21 --- /dev/null +++ b/challenge-134/roger-bell-west/python/ch-1.py @@ -0,0 +1,33 @@ +#! /usr/bin/python3 + +import unittest + +from itertools import permutations + +def pandigital(count): + digits=1 + cc=1 + while cc<count: + digits += 1 + cc *= digits + if digits > 10: + print("too large") + return [] + template=[*range(9,1,-1),0,1] + lead=template[digits:] + lead.reverse() + l="".join(str(i) for i in lead) + template=template[0:digits] + o=[] + for p in permutations(template): + o.append("".join(str(i) for i in p)) + o.sort() + o=o[0:count] + return [int(l+i) for i in o] + +class TestIsqrt(unittest.TestCase): + + def test_ex1(self): + self.assertEqual(pandigital(10),[1023456789, 1023456798, 1023456879, 1023456897, 1023456978, 1023456987, 1023457689, 1023457698, 1023457869, 1023457896],'example 1') + +unittest.main() diff --git a/challenge-134/roger-bell-west/raku/ch-1.p6 b/challenge-134/roger-bell-west/raku/ch-1.p6 new file mode 100755 index 0000000000..99918b31ab --- /dev/null +++ b/challenge-134/roger-bell-west/raku/ch-1.p6 @@ -0,0 +1,30 @@ +#! /usr/bin/perl6 + +use Test; + +plan 1; + +is-deeply(pandigital(10),[1023456789, 1023456798, 1023456879, 1023456897, 1023456978, 1023456987, 1023457689, 1023457698, 1023457869, 1023457896],'example 1'); + +sub pandigital($count) { + my $digits=1; + my $cc=1; + while ($cc < $count) { + $digits++; + $cc*=$digits; + if ($digits > 10) { + die "too large\n"; + } + } + my @template=reverse (1,0,2,3,4,5,6,7,8,9); + my @o; + my @lead=reverse splice @template,$digits; + for @template.permutations -> @r { + push @o,join('',@r); + } + @o=sort @o; + splice @o,$count; + my $l=join('',@lead); + @o=map {"$l$_"+0},@o; + return @o; +} diff --git a/challenge-134/roger-bell-west/raku/ch-2.p6 b/challenge-134/roger-bell-west/raku/ch-2.p6 new file mode 100755 index 0000000000..945ffd929d --- /dev/null +++ b/challenge-134/roger-bell-west/raku/ch-2.p6 @@ -0,0 +1,49 @@ +#! /usr/bin/perl6 + +distinctterms(3,3); + +distinctterms(3,5); + +sub distinctterms($m,$n) { + my @r; + push @r,[('x',1..$n).flat]; + my %terms; + for (1..$m) -> $mm { + my @q=($mm); + for (1..$n) -> $nn { + my $p=$mm*$nn; + push @q,$p; + %terms{$p}=1; + } + push @r,@q; + } + my @cw=(0,0); + for @r -> @rr { + for (0..@rr.end) -> $ci { + my $wi=$ci==0 ?? 0 !! 1; + @cw[$wi]=max(@cw[$wi],chars(@rr[$ci])); + } + } + for (0..@r.end) -> $ri { + my @k; + if ($ri==0) { + push @k,sprintf('%' ~ @cw[0] ~ 's',@r[$ri][0]); + } else { + push @k,sprintf('%' ~ @cw[0] ~ 'd',@r[$ri][0]); + } + push @k,'|'; + for (1..@r[$ri].end) -> $ci { + push @k,sprintf('%' ~ @cw[1] ~ 'd',@r[$ri][$ci]); + } + my $l=join(' ',@k); + say $l; + if ($ri==0) { + $l ~~ s:g/<-[|]>/-/; + $l ~~ s:g/\|/+/; + say $l; + } + } + say ""; + say "Distinct Terms: " ~ join(', ',sort { $^a <=> $^b },keys %terms); + say "Count: " ~ (%terms.keys.elems); +} diff --git a/challenge-134/roger-bell-west/ruby/ch-1.rb b/challenge-134/roger-bell-west/ruby/ch-1.rb new file mode 100755 index 0000000000..9cf573469d --- /dev/null +++ b/challenge-134/roger-bell-west/ruby/ch-1.rb @@ -0,0 +1,37 @@ +#! /usr/bin/ruby + +def pandigital(count) + digits=1 + cc=1 + while cc<count do + digits += 1 + cc *= digits + if digits > 10 then + return [] + end + end + template=(2..9).to_a + template.unshift(0) + template.unshift(1) + template.reverse! + lead=template[digits..-1].reverse + template=template[0..digits-1] + o=[] + template.permutation do |r| + o.push(r.join) + end + o.sort! + o=o[0..count-1] + l=lead.join + return o.map{|j| (l+j).to_i} +end + +require 'test/unit' + +class TestIsqrt < Test::Unit::TestCase + + def test_ex1 + assert_equal([1023456789, 1023456798, 1023456879, 1023456897, 1023456978, 1023456987, 1023457689, 1023457698, 1023457869, 1023457896],pandigital(10)) + end + +end diff --git a/challenge-134/roger-bell-west/rust/ch-1.rs b/challenge-134/roger-bell-west/rust/ch-1.rs new file mode 100755 index 0000000000..d549b846d8 --- /dev/null +++ b/challenge-134/roger-bell-west/rust/ch-1.rs @@ -0,0 +1,35 @@ +use permutator::Permutation; + +#[test] +fn test_ex1() { + assert_eq!(pandigital(10),vec![1023456789, 1023456798, 1023456879, 1023456897, 1023456978, 1023456987, 1023457689, 1023457698, 1023457869, 1023457896]); +} + +fn pandigital(count: u32) -> Vec<u32> { + let mut digits=1; + let mut cc=1; + while cc < count { + digits+=1; + cc *= digits; + if digits > 10 { + println!("too large"); + return vec![]; + } + } + let mut template=(2..=9).collect::<Vec<u32>>(); + template.reverse(); + template.push(0); + template.push(1); + let mut lead=vec![0;10-digits as usize]; + lead.clone_from_slice(&template[(digits as usize)..]); + lead.reverse(); + let l=lead.into_iter().map(|i| i.to_string()).collect::<Vec<String>>().join(""); + template.resize(digits as usize,0); + let mut o=vec![]; + template.permutation().for_each(|p| { + o.push((&p).into_iter().map(|i| i.to_string()).collect::<Vec<String>>().join("")); + }); + o.sort(); + o.resize(count as usize,"".to_string()); + o.into_iter().map(|i| (l.clone()+&i).parse().unwrap()).collect::<Vec<u32>>() +} diff --git a/challenge-134/ulrich-rieke/cpp/ch-1.cpp b/challenge-134/ulrich-rieke/cpp/ch-1.cpp new file mode 100644 index 0000000000..51b1f95beb --- /dev/null +++ b/challenge-134/ulrich-rieke/cpp/ch-1.cpp @@ -0,0 +1,28 @@ +#include <iostream> +#include <string> +#include <vector> +#include <map> + +bool isPanDigital( long num ) { + std::map<std::string , int> digitCount ; + std::string numberstring( std::to_string( num ) ) ; + for ( int i = 0 ; i < numberstring.length( ) ; i++ ) + digitCount[ numberstring.substr( i , 1 )]++ ; + return digitCount.size( ) == 10 ; +} + +int main( ) { + std::string start { "1023456789" } ; + std::vector<long> panDigitals ; + long current = std::stol( start ) ; + panDigitals.push_back( current ) ; + while ( panDigitals.size( ) != 5 ) { + current++ ; + if ( isPanDigital( current ) ) + panDigitals.push_back( current ) ; + } + for ( auto n : panDigitals ) + std::cout << n << " " ; + std::cout << std::endl ; + return 0 ; +} diff --git a/challenge-134/ulrich-rieke/cpp/ch-2.cpp b/challenge-134/ulrich-rieke/cpp/ch-2.cpp new file mode 100644 index 0000000000..51cb0248a2 --- /dev/null +++ b/challenge-134/ulrich-rieke/cpp/ch-2.cpp @@ -0,0 +1,50 @@ +#include <iostream> +#include <cstdlib> +#include <string> +#include <set> +#include <vector> +#include <algorithm> +#include <iterator> + +int main( int argc , char * argv[ ] ) { + int m = std::atoi( argv[ 1 ] ) ; + int n = std::atoi( argv[ 2 ] ) ; + int num_maxwidth = std::to_string( m * n ).length( ) + 1 ; + int firstColWidth = std::to_string( m ).length( ) + 2 ; + std::cout << 'x' ; + std::cout.width( firstColWidth - 1 ) ; + std::cout << '|' ; + for ( int i = 1 ; i < n + 1 ; i++ ) { + std::cout.width( num_maxwidth ) ; + std::cout << i ; + } + std::cout << '\n' ; + for ( int i = 1 ; i < firstColWidth ; i++ ) + std::cout << '-' ; + std::cout << '+' ; + for ( int i = 0 ; i < num_maxwidth * n ; i++ ) + std::cout << '-' ; + std::cout << '\n' ; + std::set<int> distinctTerms ; + for ( int i = 1 ; i < m + 1 ; i++ ) { + std::cout << i ; + int w = std::to_string( i ).length( ) ; + std::cout.width( firstColWidth - w ) ; + std::cout << '|' ; + for ( int j = 1 ; j < n + 1 ; j++ ) { + std::cout.width( num_maxwidth ) ; + std::cout << i * j ; + distinctTerms.insert( i * j ) ; + } + std::cout << '\n' ; + } + std::cout << std::endl ; + std::vector<int> terms ( distinctTerms.begin( ) , distinctTerms.end( ) ) ; + std::sort( terms.begin( ) , terms.end( ) ) ; + std::cout << "Distinct Terms: " ; + std::copy( terms.begin( ) , terms.end( ) , std::ostream_iterator<int>( + std::cout , " " )) ; + std::cout << '\n' ; + std::cout << "Count: " << terms.size( ) << std::endl ; + return 0 ; +} diff --git a/challenge-134/ulrich-rieke/haskell/ch-1.hs b/challenge-134/ulrich-rieke/haskell/ch-1.hs new file mode 100644 index 0000000000..0fa1a20bc2 --- /dev/null +++ b/challenge-134/ulrich-rieke/haskell/ch-1.hs @@ -0,0 +1,12 @@ +module Challenge134 + where +import qualified Data.Set as S + +isPandigital :: Integer -> Bool +isPandigital s = (S.size $ S.fromList $ show s ) == 10 + +solution :: [Integer] +solution = take 5 $ filter isPandigital [start , start + 1 ..] +where + start :: Integer + start = 1023456789 diff --git a/challenge-134/ulrich-rieke/perl/ch-1.pl b/challenge-134/ulrich-rieke/perl/ch-1.pl new file mode 100644 index 0000000000..d6945c190e --- /dev/null +++ b/challenge-134/ulrich-rieke/perl/ch-1.pl @@ -0,0 +1,31 @@ +#!/usr/bin/perl ; +use strict ; +use warnings ; +use feature 'say' ; +use Math::BigInt ; + +#the smallest pandigit 10-based number must begin with "10" , the rest of +#the other digits must follow in numerical order ; + +sub isPandigital { + my $number = shift ; + my %digitCount ; + my $numstring = $number->bstr( ) ; + for my $digit ( split ( // , $numstring ) ) { + $digitCount{ $digit }++ ; + } + return ( (scalar ( keys %digitCount )) == 10 ) ; +} + +my @panDigitals ; +my $start = Math::BigInt->new( "1023456789" ) ; +my $one = Math::BigInt->new( "1" ) ; +my $current = $start->copy( ) ; +push( @panDigitals , $start ) ; +while ( (scalar @panDigitals) != 5 ) { + $current = $current->badd( $one ) ; + if ( isPandigital( $current ) ) { + push ( @panDigitals , $current ) ; + } +} +say join( ", " , map { $_->bstr( ) } @panDigitals ) ; diff --git a/challenge-134/ulrich-rieke/raku/ch-1.raku b/challenge-134/ulrich-rieke/raku/ch-1.raku new file mode 100644 index 0000000000..a22d8c2587 --- /dev/null +++ b/challenge-134/ulrich-rieke/raku/ch-1.raku @@ -0,0 +1,22 @@ +use v6 ; + +#we find the first pandigital at base 10 by concatenating 10 as the first +#2 digits with (2 .. 9 ) as the remaining digits in ascending order +#we then add figures consecutively + +sub isPandigital( Int $n is copy --> Bool ) { + my $numberstring = ~$n ; + return $numberstring.comb.Set.elems == 10 ; +} + +my @panDigitals ; +my $start = "10" ~ (2..9).join ; +@panDigitals.push( $start ) ; +my $current = +$start ; +while ( @panDigitals.elems != 5 ) { + repeat { + $current++ ; + } until ( isPandigital( $current )) ; + @panDigitals.push( $current ) ; +} +say @panDigitals.join(", ") ; diff --git a/challenge-134/ulrich-rieke/raku/ch-2.raku b/challenge-134/ulrich-rieke/raku/ch-2.raku new file mode 100644 index 0000000000..440349486b --- /dev/null +++ b/challenge-134/ulrich-rieke/raku/ch-2.raku @@ -0,0 +1,34 @@ +use v6 ; + +subset Positive of Int where * > 0 ; +sub MAIN( Positive $m is copy , Positive $n is copy ) { + say " " ; + my @currentRow ; + my $maximumWidth = ($m * $n).Str.chars + 1 ; + my $maxFirstColumnWidth = $m.Str.chars + 1 ; + @currentRow.push( sprintf( "%-*s" , $maxFirstColumnWidth , "x" ) ) ; + @currentRow.push( "|" ) ; + for (1 .. $n) -> $i { + @currentRow.push( sprintf( "%*d", $maximumWidth, $i )) ; + } + @currentRow.join.say ; + print "-" x $maxFirstColumnWidth ; + print "+" ; + say "-" x ( $maximumWidth * $n ) ; + my @allProducts ; + @currentRow = ( ) ; + for (1 .. $m) -> $i { + @currentRow.push(sprintf("%-*s" , $maxFirstColumnWidth , "$i")) ; + @currentRow.push( "|" ) ; + for (1 .. $n) -> $j { + @currentRow.push( sprintf("%*d" , $maximumWidth, $i * $j )) ; + @allProducts.push( $i * $j ) ; + } + @currentRow.join.say ; + @currentRow = ( ) ; + } + my $distinctTerms = @allProducts.Set ; + say " " ; + say "Distinct Terms: " ~ $distinctTerms.keys.sort.join(", ") ; + say "Count: {$distinctTerms.elems}" ; +} diff --git a/stats/pwc-current.json b/stats/pwc-current.json index a42e7c3c72..30bea94dae 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -1,58 +1,30 @@ { "plotOptions" : { "series" : { - "borderWidth" : 0, "dataLabels" : { "format" : "{point.y}", "enabled" : 1 - } - } - }, - "series" : [ - { - "data" : [ - { - "y" : 4, - "drilldown" : "Luca Ferrari", - "name" : "Luca Ferrari" - }, - { - "drilldown" : "Mark Anderson", - "y" : 2, - "name" : "Mark Anderson" - }, - { - "y" : 2, - "drilldown" : "Simon Proctor", - "name" : "Simon Proctor" - } - ], - "name" : "The Weekly Challenge - 134", - "colorByPoint" : 1 - } - ], - "legend" : { - "enabled" : 0 - }, - "chart" : { - "type" : "column" - }, - "title" : { - "text" : "The Weekly Challenge - 134" - }, - "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/>" - }, - "yAxis" : { - "title" : { - "text" : "Total Solutions" + }, + "borderWidth" : 0 } }, "drilldown" : { "series" : [ { + "id" : "Andinus", + "name" : "Andinus", + "data" : [ + [ + "Raku", + 1 + ], + [ + "Blog", + 1 + ] + ] + }, + {< |
