From 5c8e8f2ff328787cd1b23f2a70ebbb05fefbe134 Mon Sep 17 00:00:00 2001 From: Roger Bell_West Date: Mon, 21 Feb 2022 10:29:36 +0000 Subject: Solutions for challenge #153 --- challenge-153/roger-bell-west/javascript/ch-1.js | 46 +++++++++++++++++++++ challenge-153/roger-bell-west/javascript/ch-2.js | 35 ++++++++++++++++ challenge-153/roger-bell-west/kotlin/ch-1.kt | 22 ++++++++++ challenge-153/roger-bell-west/kotlin/ch-2.kt | 34 ++++++++++++++++ challenge-153/roger-bell-west/lua/ch-1.lua | 51 ++++++++++++++++++++++++ challenge-153/roger-bell-west/lua/ch-2.lua | 34 ++++++++++++++++ challenge-153/roger-bell-west/perl/ch-1.pl | 23 +++++++++++ challenge-153/roger-bell-west/perl/ch-2.pl | 30 ++++++++++++++ challenge-153/roger-bell-west/postscript/ch-1.ps | 43 ++++++++++++++++++++ challenge-153/roger-bell-west/postscript/ch-2.ps | 33 +++++++++++++++ challenge-153/roger-bell-west/python/ch-1.py | 21 ++++++++++ challenge-153/roger-bell-west/python/ch-2.py | 28 +++++++++++++ challenge-153/roger-bell-west/raku/ch-1.p6 | 21 ++++++++++ challenge-153/roger-bell-west/raku/ch-2.p6 | 29 ++++++++++++++ challenge-153/roger-bell-west/ruby/ch-1.rb | 25 ++++++++++++ challenge-153/roger-bell-west/ruby/ch-2.rb | 34 ++++++++++++++++ challenge-153/roger-bell-west/rust/ch-1.rs | 24 +++++++++++ challenge-153/roger-bell-west/rust/ch-2.rs | 31 ++++++++++++++ 18 files changed, 564 insertions(+) create mode 100755 challenge-153/roger-bell-west/javascript/ch-1.js create mode 100755 challenge-153/roger-bell-west/javascript/ch-2.js create mode 100644 challenge-153/roger-bell-west/kotlin/ch-1.kt create mode 100644 challenge-153/roger-bell-west/kotlin/ch-2.kt create mode 100755 challenge-153/roger-bell-west/lua/ch-1.lua create mode 100755 challenge-153/roger-bell-west/lua/ch-2.lua create mode 100755 challenge-153/roger-bell-west/perl/ch-1.pl create mode 100755 challenge-153/roger-bell-west/perl/ch-2.pl create mode 100644 challenge-153/roger-bell-west/postscript/ch-1.ps create mode 100644 challenge-153/roger-bell-west/postscript/ch-2.ps create mode 100755 challenge-153/roger-bell-west/python/ch-1.py create mode 100755 challenge-153/roger-bell-west/python/ch-2.py create mode 100755 challenge-153/roger-bell-west/raku/ch-1.p6 create mode 100755 challenge-153/roger-bell-west/raku/ch-2.p6 create mode 100755 challenge-153/roger-bell-west/ruby/ch-1.rb create mode 100755 challenge-153/roger-bell-west/ruby/ch-2.rb create mode 100755 challenge-153/roger-bell-west/rust/ch-1.rs create mode 100755 challenge-153/roger-bell-west/rust/ch-2.rs diff --git a/challenge-153/roger-bell-west/javascript/ch-1.js b/challenge-153/roger-bell-west/javascript/ch-1.js new file mode 100755 index 0000000000..2ff2c58cfd --- /dev/null +++ b/challenge-153/roger-bell-west/javascript/ch-1.js @@ -0,0 +1,46 @@ +#! /usr/bin/node +function deepEqual(a,b) +{ + if( (typeof a == 'object' && a != null) && + (typeof b == 'object' && b != null) ) + { + var count = [0,0]; + for( var key in a) count[0]++; + for( var key in b) count[1]++; + if( count[0]-count[1] != 0) {return false;} + for( var key in a) + { + if(!(key in b) || !deepEqual(a[key],b[key])) {return false;} + } + for( var key in b) + { + if(!(key in a) || !deepEqual(b[key],a[key])) {return false;} + } + return true; + } + else + { + return a === b; + } +} + +function leftfactorial (mx) { + let out=[]; + let fact=1; + let sum=0; + for (let i=0; i < mx; i++) { + if (i>0) { + fact *= i; + } + sum += fact; + out.push(sum); + } + return out; +} + +if (deepEqual(leftfactorial(10),[1, 2, 4, 10, 34, 154, 874, 5914, 46234, 409114])) { + process.stdout.write("Pass"); +} else { + process.stdout.write("FAIL"); +} +process.stdout.write("\n"); diff --git a/challenge-153/roger-bell-west/javascript/ch-2.js b/challenge-153/roger-bell-west/javascript/ch-2.js new file mode 100755 index 0000000000..08c3cb40b9 --- /dev/null +++ b/challenge-153/roger-bell-west/javascript/ch-2.js @@ -0,0 +1,35 @@ +#! /usr/bin/node + +function factorion (input) { + if (input==0) { + return false; + } + let fd=[1]; + let ff=1; + for (let i=1; i<=9; i++) { + ff *= i; + fd.push(ff); + } + let working=input; + let dsum=0; + while (working > 0) { + dsum += fd[working%10]; + working=Math.floor(working/10); + } + return (input == dsum); +} + +if (factorion(145)) { + process.stdout.write("Pass"); +} else { + process.stdout.write("FAIL"); +} +process.stdout.write(" "); + +if (!factorion(125)) { + process.stdout.write("Pass"); +} else { + process.stdout.write("FAIL"); +} +process.stdout.write("\n"); + diff --git a/challenge-153/roger-bell-west/kotlin/ch-1.kt b/challenge-153/roger-bell-west/kotlin/ch-1.kt new file mode 100644 index 0000000000..2339e15e27 --- /dev/null +++ b/challenge-153/roger-bell-west/kotlin/ch-1.kt @@ -0,0 +1,22 @@ +fun leftfactorial(mx: Int): ArrayList { + var out=ArrayList() + var fact=1 + var sum=0 + for (i in 0..mx-1) { + if (i > 0) { + fact *= i + } + sum += fact + out.add(sum) + } + return out +} + +fun main() { + if (leftfactorial(10) == listOf(1, 2, 4, 10, 34, 154, 874, 5914, 46234, 409114)) { + print("Pass") + } else { + print("FAIL") + } + println("") +} diff --git a/challenge-153/roger-bell-west/kotlin/ch-2.kt b/challenge-153/roger-bell-west/kotlin/ch-2.kt new file mode 100644 index 0000000000..a813e6c89f --- /dev/null +++ b/challenge-153/roger-bell-west/kotlin/ch-2.kt @@ -0,0 +1,34 @@ +fun factorion(input: Int): Boolean { + if (input == 0) { + return false + } + var fd=ArrayList() + fd.add(1) + var ff=1 + for (i in 1..9) { + ff *= i + fd.add(ff) + } + var working=input + var dsum=0 + while (working > 0) { + dsum += fd[working % 10] + working /= 10 + } + return input == dsum +} + +fun main() { + if (factorion(145)) { + print("Pass") + } else { + print("FAIL") + } + print(" ") + if (!factorion(125)) { + print("Pass") + } else { + print("FAIL") + } + println("") +} diff --git a/challenge-153/roger-bell-west/lua/ch-1.lua b/challenge-153/roger-bell-west/lua/ch-1.lua new file mode 100755 index 0000000000..b1611cd1fc --- /dev/null +++ b/challenge-153/roger-bell-west/lua/ch-1.lua @@ -0,0 +1,51 @@ +#! /usr/bin/lua + +-- by Michael Anderson at +-- https://stackoverflow.com/questions/8722620/comparing-two-index-tables-by-index-value-in-lua +function recursive_compare(t1,t2) + -- Use usual comparison first. + if t1==t2 then return true end + -- We only support non-default behavior for tables + if (type(t1)~="table") then return false end + -- They better have the same metatables + local mt1 = getmetatable(t1) + local mt2 = getmetatable(t2) + if( not recursive_compare(mt1,mt2) ) then return false end + + -- Check each key-value pair + -- We have to do this both ways in case we miss some. + -- TODO: Could probably be smarter and not check those we've + -- already checked though! + for k1,v1 in pairs(t1) do + local v2 = t2[k1] + if( not recursive_compare(v1,v2) ) then return false end + end + for k2,v2 in pairs(t2) do + local v1 = t1[k2] + if( not recursive_compare(v1,v2) ) then return false end + end + + return true +end + +function leftfactorial(mx) + out = {} + fact = 1 + sum = 0 + for i = 0, mx-1 do + if i > 0 then + fact = fact * i + end + sum = sum + fact + table.insert(out,sum) + end + return out +end + +if recursive_compare(leftfactorial(10),{1, 2, 4, 10, 34, 154, 874, + 5914, 46234, 409114}) then + io.write("Pass") +else + io.write("FAIL") +end +print("") diff --git a/challenge-153/roger-bell-west/lua/ch-2.lua b/challenge-153/roger-bell-west/lua/ch-2.lua new file mode 100755 index 0000000000..93d5253d94 --- /dev/null +++ b/challenge-153/roger-bell-west/lua/ch-2.lua @@ -0,0 +1,34 @@ +#! /usr/bin/lua + +function factorion(input) + if input == 0 then + return false + end + fd={1} + ff=1 + for i = 1, 9 do + ff = ff * i + table.insert(fd,ff) + end + working = input + dsum = 0 + while working > 0 do + dsum = dsum + fd[(working % 10) + 1] + working = math.floor(working/10) + end + return input == dsum +end + +if factorion(145) then + io.write("Pass") +else + io.write("FAIL") +end +io.write(" ") + +if not factorion(125) then + io.write("Pass") +else + io.write("FAIL") +end +print("") diff --git a/challenge-153/roger-bell-west/perl/ch-1.pl b/challenge-153/roger-bell-west/perl/ch-1.pl new file mode 100755 index 0000000000..c905708fef --- /dev/null +++ b/challenge-153/roger-bell-west/perl/ch-1.pl @@ -0,0 +1,23 @@ +#! /usr/bin/perl + +use strict; +use warnings; + +use Test::More tests => 1; + +is_deeply(leftfactorial(10),[1, 2, 4, 10, 34, 154, 874, 5914, 46234, 409114],'example 1'); + +sub leftfactorial { + my $mx = shift; + my @out; + my $fact=1; + my $sum=0; + foreach my $i (0..$mx-1) { + if ($i>0) { + $fact *= $i; + } + $sum += $fact; + push @out,$sum; + } + return \@out; +} diff --git a/challenge-153/roger-bell-west/perl/ch-2.pl b/challenge-153/roger-bell-west/perl/ch-2.pl new file mode 100755 index 0000000000..8c5bd1263a --- /dev/null +++ b/challenge-153/roger-bell-west/perl/ch-2.pl @@ -0,0 +1,30 @@ +#! /usr/bin/perl + +use strict; +use warnings; + +use Test::More tests => 2; + +is(factorion(145),1,'example 1'); + +is(factorion(125),0,'example 2'); + +sub factorion { + my $input = shift; + if ($input==0) { + return 0; + } + my @fd=(1); + my $ff=1; + foreach my $i (1..9) { + $ff *= $i; + push @fd,$ff; + } + my $working=$input; + my $dsum=0; + while ($working > 0) { + $dsum += $fd[$working%10]; + $working=int($working/10); + } + return ($input==$dsum)?1:0; +} diff --git a/challenge-153/roger-bell-west/postscript/ch-1.ps b/challenge-153/roger-bell-west/postscript/ch-1.ps new file mode 100644 index 0000000000..904313b320 --- /dev/null +++ b/challenge-153/roger-bell-west/postscript/ch-1.ps @@ -0,0 +1,43 @@ +%!PS + +/aeq { + 2 dict begin + /a exch def + /b exch def + a length b length eq { + /e true def + 0 1 a length 1 sub { + dup a exch get + exch b exch get ne { + /e false def + exit + } if + } for + e + } { + false + } ifelse + end +} bind def + +/leftfactorial { + 4 dict begin + /mx exch def + /out mx array def + /fact 1 def + /sum 0 def + 0 1 mx 1 sub { + dup + dup 0 eq { + pop + } { + fact mul /fact exch def + } ifelse + sum fact add /sum exch def + out exch sum put + } for + out + end +} bind def + +10 leftfactorial [ 1 2 4 10 34 154 874 5914 46234 409114 ] aeq { (Pass) } { (FAIL) } ifelse = diff --git a/challenge-153/roger-bell-west/postscript/ch-2.ps b/challenge-153/roger-bell-west/postscript/ch-2.ps new file mode 100644 index 0000000000..07dd88069d --- /dev/null +++ b/challenge-153/roger-bell-west/postscript/ch-2.ps @@ -0,0 +1,33 @@ +%!PS + +/factorion { + dup 0 eq { + false + } { + 3 dict begin + /fd 10 array def + fd 0 1 put + 1 + 1 1 9 { + dup 3 1 roll mul + dup fd exch 4 -1 roll exch put + } for + pop + /input exch def + /working input def + 0 + { + working 0 gt { + fd working 10 mod get add + /working working 10 idiv def + } { + exit + } ifelse + } loop + input eq + end + } ifelse +} bind def + +145 factorion { (Pass) } { (FAIL) } ifelse print ( ) print +125 factorion not { (Pass) } { (FAIL) } ifelse = diff --git a/challenge-153/roger-bell-west/python/ch-1.py b/challenge-153/roger-bell-west/python/ch-1.py new file mode 100755 index 0000000000..e94ddd0f88 --- /dev/null +++ b/challenge-153/roger-bell-west/python/ch-1.py @@ -0,0 +1,21 @@ +#! /usr/bin/python3 + +import unittest + +def leftfactorial(mx): + out=[] + fact=1 + sm=0 + for i in range(mx): + if i > 0: + fact *= i + sm += fact + out.append(sm) + return out + +class TestLeftfactorial(unittest.TestCase): + + def test_ex1(self): + self.assertEqual(leftfactorial(10),[1, 2, 4, 10, 34, 154, 874, 5914, 46234, 409114],'example 1') + +unittest.main() diff --git a/challenge-153/roger-bell-west/python/ch-2.py b/challenge-153/roger-bell-west/python/ch-2.py new file mode 100755 index 0000000000..f9b4c38927 --- /dev/null +++ b/challenge-153/roger-bell-west/python/ch-2.py @@ -0,0 +1,28 @@ +#! /usr/bin/python3 + +import unittest + +def factorion(input:int): + if input==0: + return False + fd=[1] + ff=1 + for i in range(1,10): + ff *= i + fd.append(ff) + working=input + dsum=0 + while working>0: + (working,d)=divmod(working,10) + dsum += fd[d] + return input==dsum + +class TestFactorion(unittest.TestCase): + + def test_ex1(self): + self.assertEqual(factorion(145),True,'example 1') + + def test_ex2(self): + self.assertEqual(factorion(125),False,'example 2') + +unittest.main() diff --git a/challenge-153/roger-bell-west/raku/ch-1.p6 b/challenge-153/roger-bell-west/raku/ch-1.p6 new file mode 100755 index 0000000000..00d2fe5a92 --- /dev/null +++ b/challenge-153/roger-bell-west/raku/ch-1.p6 @@ -0,0 +1,21 @@ +#! /usr/bin/perl6 + +use Test; + +plan 1; + +is-deeply(leftfactorial(10),[1, 2, 4, 10, 34, 154, 874, 5914, 46234, 409114],'example 1'); + +sub leftfactorial($mx) { + my @out; + my $fact=1; + my $sum=0; + for (0..$mx-1) -> $i { + if ($i > 0) { + $fact *= $i; + } + $sum += $fact; + @out.push($sum); + } + return @out; +} diff --git a/challenge-153/roger-bell-west/raku/ch-2.p6 b/challenge-153/roger-bell-west/raku/ch-2.p6 new file mode 100755 index 0000000000..7a2dfa40f9 --- /dev/null +++ b/challenge-153/roger-bell-west/raku/ch-2.p6 @@ -0,0 +1,29 @@ +#! /usr/bin/perl6 + +use Test; + +plan 2; + +is(factorion(145),True,'example 1'); + +is(factorion(125),False,'example 2'); + +sub factorion($input) { + if ($input == 0) { + return False; + } + my @fd; + @fd.push(1); + my $ff=1; + for (1..9) -> $i { + $ff *= $i; + @fd.push($ff); + } + my $working=$input; + my $dsum=0; + while ($working > 0) { + $dsum += @fd[$working % 10]; + $working=floor($working/10); + } + return $input==$dsum; +} diff --git a/challenge-153/roger-bell-west/ruby/ch-1.rb b/challenge-153/roger-bell-west/ruby/ch-1.rb new file mode 100755 index 0000000000..65a8537188 --- /dev/null +++ b/challenge-153/roger-bell-west/ruby/ch-1.rb @@ -0,0 +1,25 @@ +#! /usr/bin/ruby + +require 'test/unit' + +def leftfactorial(mx) + out=[] + fact=1 + sum=0 + 0.upto(mx-1) do |i| + if i > 0 then + fact *= i + end + sum += fact + out.push(sum) + end + return out +end + +class TestLeftfactorial < Test::Unit::TestCase + + def test_ex1 + assert_equal([1, 2, 4, 10, 34, 154, 874, 5914, 46234, 409114],leftfactorial(10)) + end + +end diff --git a/challenge-153/roger-bell-west/ruby/ch-2.rb b/challenge-153/roger-bell-west/ruby/ch-2.rb new file mode 100755 index 0000000000..03bba71a73 --- /dev/null +++ b/challenge-153/roger-bell-west/ruby/ch-2.rb @@ -0,0 +1,34 @@ +#! /usr/bin/ruby + +require 'test/unit' + +def factorion(input) + if input==0 then + return false + end + fd=[1] + ff=1 + 1.upto(10) do |i| + ff *= i + fd.push(ff) + end + working=input + dsum=0 + while working>0 do + working,d=working.divmod(10) + dsum += fd[d] + end + return input==dsum +end + +class TestFactorion < Test::Unit::TestCase + + def test_ex1 + assert_equal(true,factorion(145)) + end + + def test_ex2 + assert_equal(false,factorion(125)) + end + +end diff --git a/challenge-153/roger-bell-west/rust/ch-1.rs b/challenge-153/roger-bell-west/rust/ch-1.rs new file mode 100755 index 0000000000..36ff7b9c7d --- /dev/null +++ b/challenge-153/roger-bell-west/rust/ch-1.rs @@ -0,0 +1,24 @@ +#! /bin/sh +//usr/bin/env rustc --test $0 -o ${0}x && ./${0}x --nocapture; rm -f ${0}x ; exit + +#[test] +fn test_ex1() { + assert_eq!( + leftfactorial(10), + vec![1, 2, 4, 10, 34, 154, 874, 5914, 46234, 409114] + ); +} + +fn leftfactorial(mx: u32) -> Vec { + let mut out = Vec::new(); + let mut fact = 1; + let mut sum = 0; + for i in 0..mx { + if i > 0 { + fact *= i; + } + sum += fact; + out.push(sum); + } + out +} diff --git a/challenge-153/roger-bell-west/rust/ch-2.rs b/challenge-153/roger-bell-west/rust/ch-2.rs new file mode 100755 index 0000000000..0d08a6afb9 --- /dev/null +++ b/challenge-153/roger-bell-west/rust/ch-2.rs @@ -0,0 +1,31 @@ +#! /bin/sh +//usr/bin/env rustc --test $0 -o ${0}x && ./${0}x --nocapture; rm -f ${0}x ; exit + +#[test] +fn test_ex1() { + assert_eq!(factorion(145), true); +} + +#[test] +fn test_ex2() { + assert_eq!(factorion(125), false); +} + +fn factorion(input: u32) -> bool { + if input == 0 { + return false; + } + let mut fd: [u32; 10] = [1; 10]; + let mut ff: u32 = 1; + for i in 1..=9 { + ff *= i as u32; + fd[i] = ff; + } + let mut working = input; + let mut dsum = 0; + while working > 0 { + dsum += fd[(working % 10) as usize]; + working /= 10; + } + input == dsum +} -- cgit From b2e1e84e428f7b584feef7f08c0f6a654f5f2176 Mon Sep 17 00:00:00 2001 From: Luca Ferrari Date: Mon, 21 Feb 2022 12:45:14 +0100 Subject: Task 1 done --- challenge-153/luca-ferrari/raku/ch-1.p6 | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 challenge-153/luca-ferrari/raku/ch-1.p6 diff --git a/challenge-153/luca-ferrari/raku/ch-1.p6 b/challenge-153/luca-ferrari/raku/ch-1.p6 new file mode 100755 index 0000000000..801a647bd3 --- /dev/null +++ b/challenge-153/luca-ferrari/raku/ch-1.p6 @@ -0,0 +1,20 @@ +#!raku + +sub MAIN( Int $limit where { $limit > 0 } = 10 ) { + my @factorials = lazy gather { + for 0 .. $limit { + take 1 if $_ <= 1; + take [*] 1 .. $_ if $_ > 1; + } + }; + + my @numbers = lazy gather { + for 0 .. $limit { + take 0 if $_ == 0; + take 1 if $_ == 1; + take @factorials[ 0 .. $_ -1 ].sum if $_ > 1; + } + }; + + @numbers[ 0 .. $limit ].join( "\n" ).say; +} -- cgit From 77bbb0679f8e3c8d0f8640c4de7217f060ac2161 Mon Sep 17 00:00:00 2001 From: Luca Ferrari Date: Mon, 21 Feb 2022 13:13:44 +0100 Subject: Task 2 done --- challenge-153/luca-ferrari/raku/ch-2.p6 | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100755 challenge-153/luca-ferrari/raku/ch-2.p6 diff --git a/challenge-153/luca-ferrari/raku/ch-2.p6 b/challenge-153/luca-ferrari/raku/ch-2.p6 new file mode 100755 index 0000000000..c7a04e83c5 --- /dev/null +++ b/challenge-153/luca-ferrari/raku/ch-2.p6 @@ -0,0 +1,6 @@ +#!raku + +sub MAIN( Int $n where { $n > 0 } ) { + '1'.say and exit if $n.comb.map( { $_ <= 1 ?? 1 !! [*] 1 .. $_ } ).sum == $n; + '0'.say; +} -- cgit From 53c3d9c84e7e9a72e729fe04b726dd243fa546d1 Mon Sep 17 00:00:00 2001 From: Mark <53903062+andemark@users.noreply.github.com> Date: Mon, 21 Feb 2022 12:34:01 +0000 Subject: Challenge 153 Solutions (Raku) --- challenge-153/mark-anderson/raku/ch-1.raku | 3 +++ challenge-153/mark-anderson/raku/ch-2.raku | 9 +++++++++ 2 files changed, 12 insertions(+) create mode 100644 challenge-153/mark-anderson/raku/ch-1.raku create mode 100644 challenge-153/mark-anderson/raku/ch-2.raku diff --git a/challenge-153/mark-anderson/raku/ch-1.raku b/challenge-153/mark-anderson/raku/ch-1.raku new file mode 100644 index 0000000000..579d14cbc8 --- /dev/null +++ b/challenge-153/mark-anderson/raku/ch-1.raku @@ -0,0 +1,3 @@ +#!/usr/bin/env raku + +say [\+] 1, |[\*] 1..9; diff --git a/challenge-153/mark-anderson/raku/ch-2.raku b/challenge-153/mark-anderson/raku/ch-2.raku new file mode 100644 index 0000000000..01d0284db5 --- /dev/null +++ b/challenge-153/mark-anderson/raku/ch-2.raku @@ -0,0 +1,9 @@ +#!/usr/bin/env raku + +say factorian(145); +say factorian(125); + +sub factorian($n) +{ + + ($n == [+] $n.comb.map: {[*] 1..$_}) +} -- cgit From e71e3e4e2783ef4238cae5707fb04a0688c6afdb Mon Sep 17 00:00:00 2001 From: Peter Campbell Smith Date: Mon, 21 Feb 2022 13:59:42 +0000 Subject: Peter Campbell Smith's solutions for week 153 --- challenge-153/peter-campbell-smith/blog.txt | 1 + challenge-153/peter-campbell-smith/perl/ch-1.pl | 27 +++++++++++++++ challenge-153/peter-campbell-smith/perl/ch-2.pl | 46 +++++++++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 challenge-153/peter-campbell-smith/blog.txt create mode 100755 challenge-153/peter-campbell-smith/perl/ch-1.pl create mode 100755 challenge-153/peter-campbell-smith/perl/ch-2.pl diff --git a/challenge-153/peter-campbell-smith/blog.txt b/challenge-153/peter-campbell-smith/blog.txt new file mode 100644 index 0000000000..363b15132b --- /dev/null +++ b/challenge-153/peter-campbell-smith/blog.txt @@ -0,0 +1 @@ +https://pjcs-pwc.blogspot.com/2022/02/task-one-is-quite-easy-factorions-are.html diff --git a/challenge-153/peter-campbell-smith/perl/ch-1.pl b/challenge-153/peter-campbell-smith/perl/ch-1.pl new file mode 100755 index 0000000000..3229afe232 --- /dev/null +++ b/challenge-153/peter-campbell-smith/perl/ch-1.pl @@ -0,0 +1,27 @@ +#!/usr/bin/perl + +# Peter Campbell Smith - 2022-02-21 +# PWC 153 task 1 + +use v5.28; +use strict; +use utf8; + +# Write a script to compute Left Factorials of 1 to 10. Please refer OEIS A003422 for more information. +# The OEIS reference says !n = Sum_{k=0..n-1} k! +# So !n = !(n-1) + (n-1)! + +my ($n, $string, @lf, @fac); + +# assume !1 and 1! +$lf[1] = 1; +$fac[1] = 1; +$string = qq[1, ]; + +# calculate the rest as per the third comment line above +for $n (2 .. 10) { + $lf[$n] = $lf[$n - 1] + $fac[$n - 1]; + $fac[$n] = $fac[$n - 1] * $n; + $string .= qq[$lf[$n], ]; +} +say substr($string, 0, -2); diff --git a/challenge-153/peter-campbell-smith/perl/ch-2.pl b/challenge-153/peter-campbell-smith/perl/ch-2.pl new file mode 100755 index 0000000000..2c6ac4024c --- /dev/null +++ b/challenge-153/peter-campbell-smith/perl/ch-2.pl @@ -0,0 +1,46 @@ +#!/usr/bin/perl + +# Peter Campbell Smith - 2022-02-21 +# PWC 153 task 2 + +use v5.28; +use strict; +use utf8; + +# You are given an integer, $n. +# Write a script to figure out if the given integer is factorion. +# A factorion is a natural number that equals the sum of the factorials of its digits. + +my (@tests, $test, $sum, @fac, $n, $not, $string1, $string2); + +# numbers to test +@tests = (1, 2, 3, 4, 125, 145, 40585, 57778); + +# calculate factorials of single digits +$fac[0] = 1; +for $n (1 .. 9) { + $fac[$n] = $n * $fac[$n - 1]; +} + +# loop over tests +for $test (@tests) { + $sum = 0; + $string1 = $string2 = ''; + + # test for being a factorion + while ($test =~ m|(\d)|g) { + $sum += $fac[$1]; + $string1 .= qq[$1! + ]; + $string2 .= qq[$fac[$1] + ]; + } + + # format output + say qq[\nInput: $test]; + $string1 =~ s|...$||; + $string2 =~ s|...$||; + if ($sum == $test) { + say qq[Output: 1 since $string1 => $string2 = $test]; + } else { + say qq[Output: 0 since $string1 => $string2 = $sum <> $test]; + } +} -- cgit From 0a5175bd0c00c08d4d645e8d44f309e67fc0c965 Mon Sep 17 00:00:00 2001 From: Michael Manring Date: Mon, 21 Feb 2022 21:39:06 +0700 Subject: PWC153 --- challenge-153/pokgopun/perl/ch-1.pl | 17 +++++++++++++++++ challenge-153/pokgopun/perl/ch-2.pl | 18 ++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 challenge-153/pokgopun/perl/ch-1.pl create mode 100644 challenge-153/pokgopun/perl/ch-2.pl diff --git a/challenge-153/pokgopun/perl/ch-1.pl b/challenge-153/pokgopun/perl/ch-1.pl new file mode 100644 index 0000000000..03ae3e16b0 --- /dev/null +++ b/challenge-153/pokgopun/perl/ch-1.pl @@ -0,0 +1,17 @@ +use strict; +use warnings; + +my $res; +foreach my $n (1..10) { + ### Left factorial which is known by the other name as subfactorial but it does not produce output similar to the example + #$res .= sprintf "%s, ", eval(join(" + ", map{ &factorial($n) / &factorial($_) * (-1)**$_ } 0..$n )); + ### The below seems to produce output similar to the example + $res .= sprintf "%s, ", eval( join( " + ", map{&factorial($_)} 0..$n-1 ) ); +} +$res =~ s/\D+$//; +printf "%s\n", $res; +sub factorial { + my $n = shift; + return $n==0 ? 1 : eval(join(" * ", 1..$n)); +} + diff --git a/challenge-153/pokgopun/perl/ch-2.pl b/challenge-153/pokgopun/perl/ch-2.pl new file mode 100644 index 0000000000..a1e87a528b --- /dev/null +++ b/challenge-153/pokgopun/perl/ch-2.pl @@ -0,0 +1,18 @@ +use strict; +use warnings; + +my @n; +push @n, @ARGV ? @ARGV : (145,123); +foreach my $n (@n) { + my @digit = $n =~ /(\d)/g; + my $res0 = join(" + ", map{$_."!"} @digit); + my $res1 = join(" + ", map{&factorial($_)} @digit); + my $res = eval($res1) == $n ? 1 : 0; + + printf "Input: \$n = %s\nOutput: %s\n\n\tSince %s => %s %s %s\n\n", $n, $res, $res0, $res1, $res ? "=" : "<>", $n; +} +sub factorial { + my $n = shift; + return $n==0 ? 1 : eval(join(" * ", 1..$n)); +} + -- cgit From 6d7e1942a22328ba6c83e771d113957909eaabcf Mon Sep 17 00:00:00 2001 From: Abigail Date: Mon, 21 Feb 2022 13:37:03 +0100 Subject: Solutions for week 153 --- challenge-153/abigail/README.md | 29 ++++++++++++++++++++++ challenge-153/abigail/awk/ch-1.awk | 19 +++++++++++++++ challenge-153/abigail/awk/ch-2.awk | 26 ++++++++++++++++++++ challenge-153/abigail/bash/ch-1.sh | 21 ++++++++++++++++ challenge-153/abigail/bash/ch-2.sh | 30 +++++++++++++++++++++++ challenge-153/abigail/basic/ch-1.bas | 9 +++++++ challenge-153/abigail/bc/ch-1.bc | 26 ++++++++++++++++++++ challenge-153/abigail/bc/ch-2.bc | 34 ++++++++++++++++++++++++++ challenge-153/abigail/befunge-93/ch-1.bf93 | 2 ++ challenge-153/abigail/c/ch-1.c | 22 +++++++++++++++++ challenge-153/abigail/c/ch-2.c | 33 +++++++++++++++++++++++++ challenge-153/abigail/cobol/ch-1.cb | 14 +++++++++++ challenge-153/abigail/csh/ch-1.csh | 11 +++++++++ challenge-153/abigail/erlang/ch-1.erl | 15 ++++++++++++ challenge-153/abigail/forth/ch-1.fs | 5 ++++ challenge-153/abigail/fortran/ch-1.f90 | 12 +++++++++ challenge-153/abigail/go/ch-1.go | 25 +++++++++++++++++++ challenge-153/abigail/go/ch-2.go | 39 ++++++++++++++++++++++++++++++ challenge-153/abigail/java/ch-1.java | 23 ++++++++++++++++++ challenge-153/abigail/java/ch-2.java | 30 +++++++++++++++++++++++ challenge-153/abigail/lua/ch-1.lua | 22 +++++++++++++++++ challenge-153/abigail/lua/ch-2.lua | 30 +++++++++++++++++++++++ challenge-153/abigail/m4/ch-1.m4 | 1 + challenge-153/abigail/mmix/ch-1.mms | 16 ++++++++++++ challenge-153/abigail/node/ch-1.js | 20 +++++++++++++++ challenge-153/abigail/node/ch-2.js | 27 +++++++++++++++++++++ challenge-153/abigail/ocaml/ch-1.ml | 9 +++++++ challenge-153/abigail/pascal/ch-1.p | 25 +++++++++++++++++++ challenge-153/abigail/pascal/ch-2.p | 36 +++++++++++++++++++++++++++ challenge-153/abigail/perl/ch-1.pl | 23 ++++++++++++++++++ challenge-153/abigail/perl/ch-2.pl | 26 ++++++++++++++++++++ challenge-153/abigail/php/ch-1.php | 11 +++++++++ challenge-153/abigail/postscript/ch-1.ps | 10 ++++++++ challenge-153/abigail/python/ch-1.py | 23 ++++++++++++++++++ challenge-153/abigail/python/ch-2.py | 28 +++++++++++++++++++++ challenge-153/abigail/r/ch-1.r | 22 +++++++++++++++++ challenge-153/abigail/r/ch-2.r | 34 ++++++++++++++++++++++++++ challenge-153/abigail/rexx/ch-1.rexx | 9 +++++++ challenge-153/abigail/ruby/ch-1.rb | 15 ++++++++++++ challenge-153/abigail/ruby/ch-2.rb | 30 +++++++++++++++++++++++ challenge-153/abigail/scheme/ch-1.scm | 23 ++++++++++++++++++ challenge-153/abigail/scheme/ch-2.scm | 35 +++++++++++++++++++++++++++ challenge-153/abigail/sed/ch-1.sed | 12 +++++++++ challenge-153/abigail/sql/ch-1.sql | 9 +++++++ challenge-153/abigail/t/ctest.ini | 11 +++++++++ challenge-153/abigail/t/input-1-1 | 1 + challenge-153/abigail/t/input-2-1 | 2 ++ challenge-153/abigail/t/output-1-1.exp | 1 + challenge-153/abigail/t/output-2-1.exp | 2 ++ challenge-153/abigail/tcl/ch-1.tcl | 21 ++++++++++++++++ challenge-153/abigail/tcl/ch-2.tcl | 24 ++++++++++++++++++ 51 files changed, 983 insertions(+) create mode 100644 challenge-153/abigail/awk/ch-1.awk create mode 100644 challenge-153/abigail/awk/ch-2.awk create mode 100644 challenge-153/abigail/bash/ch-1.sh create mode 100644 challenge-153/abigail/bash/ch-2.sh create mode 100644 challenge-153/abigail/basic/ch-1.bas create mode 100644 challenge-153/abigail/bc/ch-1.bc create mode 100644 challenge-153/abigail/bc/ch-2.bc create mode 100644 challenge-153/abigail/befunge-93/ch-1.bf93 create mode 100644 challenge-153/abigail/c/ch-1.c create mode 100644 challenge-153/abigail/c/ch-2.c create mode 100644 challenge-153/abigail/cobol/ch-1.cb create mode 100644 challenge-153/abigail/csh/ch-1.csh create mode 100644 challenge-153/abigail/erlang/ch-1.erl create mode 100644 challenge-153/abigail/forth/ch-1.fs create mode 100644 challenge-153/abigail/fortran/ch-1.f90 create mode 100644 challenge-153/abigail/go/ch-1.go create mode 100644 challenge-153/abigail/go/ch-2.go create mode 100644 challenge-153/abigail/java/ch-1.java create mode 100644 challenge-153/abigail/java/ch-2.java create mode 100644 challenge-153/abigail/lua/ch-1.lua create mode 100644 challenge-153/abigail/lua/ch-2.lua create mode 100644 challenge-153/abigail/m4/ch-1.m4 create mode 100644 challenge-153/abigail/mmix/ch-1.mms create mode 100644 challenge-153/abigail/node/ch-1.js create mode 100644 challenge-153/abigail/node/ch-2.js create mode 100644 challenge-153/abigail/ocaml/ch-1.ml create mode 100644 challenge-153/abigail/pascal/ch-1.p create mode 100644 challenge-153/abigail/pascal/ch-2.p create mode 100644 challenge-153/abigail/perl/ch-1.pl create mode 100644 challenge-153/abigail/perl/ch-2.pl create mode 100644 challenge-153/abigail/php/ch-1.php create mode 100644 challenge-153/abigail/postscript/ch-1.ps create mode 100644 challenge-153/abigail/python/ch-1.py create mode 100644 challenge-153/abigail/python/ch-2.py create mode 100644 challenge-153/abigail/r/ch-1.r create mode 100644 challenge-153/abigail/r/ch-2.r create mode 100644 challenge-153/abigail/rexx/ch-1.rexx create mode 100644 challenge-153/abigail/ruby/ch-1.rb create mode 100644 challenge-153/abigail/ruby/ch-2.rb create mode 100644 challenge-153/abigail/scheme/ch-1.scm create mode 100644 challenge-153/abigail/scheme/ch-2.scm create mode 100644 challenge-153/abigail/sed/ch-1.sed create mode 100644 challenge-153/abigail/sql/ch-1.sql create mode 100644 challenge-153/abigail/t/ctest.ini create mode 100644 challenge-153/abigail/t/input-1-1 create mode 100644 challenge-153/abigail/t/input-2-1 create mode 100644 challenge-153/abigail/t/output-1-1.exp create mode 100644 challenge-153/abigail/t/output-2-1.exp create mode 100644 challenge-153/abigail/tcl/ch-1.tcl create mode 100644 challenge-153/abigail/tcl/ch-2.tcl diff --git a/challenge-153/abigail/README.md b/challenge-153/abigail/README.md index 9b1fd5d762..818ee634c4 100644 --- a/challenge-153/abigail/README.md +++ b/challenge-153/abigail/README.md @@ -4,21 +4,50 @@ * [AWK](awk/ch-1.awk) * [Bash](bash/ch-1.sh) +* [Basic](basic/ch-1.bas) +* [bc](bc/ch-1.bc) +* [Befunge-93](befunge-93/ch-1.bf93) * [C](c/ch-1.c) +* [Cobol](cobol/ch-1.cb) +* [Csh](csh/ch-1.csh) +* [Erlang](erlang/ch-1.erl) +* [Forth](forth/ch-1.fs) +* [Fortran](fortran/ch-1.f90) +* [Go](go/ch-1.go) +* [Java](java/ch-1.java) * [Lua](lua/ch-1.lua) +* [M4](m4/ch-1.m4) +* [MMIX](mmix/ch-1.mms) * [Node.js](node/ch-1.js) +* [OCaml](ocaml/ch-1.ml) +* [Pascal](pascal/ch-1.p) * [Perl](perl/ch-1.pl) +* [PHP](php/ch-1.php) +* [PostScript](postscript/ch-1.ps) * [Python](python/ch-1.py) +* [R](r/ch-1.r) +* [Rexx](rexx/ch-1.rexx) * [Ruby](ruby/ch-1.rb) +* [Scheme](scheme/ch-1.scm) +* [sed](sed/ch-1.sed) +* [sql](sql/ch-1.sql) +* [Tcl](tcl/ch-1.tcl) ## Part 2 * [AWK](awk/ch-2.awk) * [Bash](bash/ch-2.sh) +* [bc](bc/ch-2.bc) * [C](c/ch-2.c) +* [Go](go/ch-2.go) +* [Java](java/ch-2.java) * [Lua](lua/ch-2.lua) * [Node.js](node/ch-2.js) +* [Pascal](pascal/ch-2.p) * [Perl](perl/ch-2.pl) * [Python](python/ch-2.py) +* [R](r/ch-2.r) * [Ruby](ruby/ch-2.rb) +* [Scheme](scheme/ch-1.scm) +* [Tcl](tcl/ch-2.tcl) diff --git a/challenge-153/abigail/awk/ch-1.awk b/challenge-153/abigail/awk/ch-1.awk new file mode 100644 index 0000000000..e4a0e26b29 --- /dev/null +++ b/challenge-153/abigail/awk/ch-1.awk @@ -0,0 +1,19 @@ +#!/usr/bin/awk + +# +# See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 +# + +# +# Run as: awk -f ch-1.awk +# + +BEGIN { + sum = 1 + fac = 1 + printf "%d", sum + for (n = 1; n <= 9; n ++) { + printf " %d", sum += fac *= n + } + printf "\n" +} diff --git a/challenge-153/abigail/awk/ch-2.awk b/challenge-153/abigail/awk/ch-2.awk new file mode 100644 index 0000000000..0ce3b6f0a6 --- /dev/null +++ b/challenge-153/abigail/awk/ch-2.awk @@ -0,0 +1,26 @@ +#!/usr/bin/awk + +# +# See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 +# + +# +# Run as: awk -f ch-1.awk < input-file +# + +BEGIN { + fac [0] = 1 + for (n = 1; n <= 9; n ++) { + fac [n] = n * fac [n - 1] + } +} + +{ + sum = 0 + n = $1 + while (n > 0) { + sum += fac [n % 10] + n = int (n / 10) + } + print sum == $1 ? 1 : 0 +} diff --git a/challenge-153/abigail/bash/ch-1.sh b/challenge-153/abigail/bash/ch-1.sh new file mode 100644 index 0000000000..289ffc568e --- /dev/null +++ b/challenge-153/abigail/bash/ch-1.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +# +# See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 +# + +# +# Run as: bash ch-1.sh +# + +set -f + +((sum = 1)) +((fac = 1)) +printf %d $sum +for ((n = 1; n <= 9; n ++)) +do ((fac *= n)) + ((sum += fac)) + printf " %d" $sum +done +echo diff --git a/challenge-153/abigail/bash/ch-2.sh b/challenge-153/abigail/bash/ch-2.sh new file mode 100644 index 0000000000..a685d42993 --- /dev/null +++ b/challenge-153/abigail/bash/ch-2.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +# +# See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 +# + +# +# Run as: bash ch-2.sh < input-file +# + +set -f + +declare -a fac +fac[0]=1 +for ((n = 1; n <= 9; n ++)) +do fac[$n]=$((n * ${fac[$((n - 1))]})) +done + +while read num +do ((n = num)) + ((sum = 0)) + while ((n > 0)) + do ((sum += ${fac[n % 10]})) + ((n /= 10)) + done + if ((sum == num)) + then echo 1 + else echo 0 + fi +done diff --git a/challenge-153/abigail/basic/ch-1.bas b/challenge-153/abigail/basic/ch-1.bas new file mode 100644 index 0000000000..f50baa1acf --- /dev/null +++ b/challenge-153/abigail/basic/ch-1.bas @@ -0,0 +1,9 @@ +010 REM +020 REM See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 +030 REM + +040 REM +050 REM Run as: basic ch-1.bas +060 REM + +100 PRINT "1 2 4 10 34 154 874 5914 46234 409114" diff --git a/challenge-153/abigail/bc/ch-1.bc b/challenge-153/abigail/bc/ch-1.bc new file mode 100644 index 0000000000..b5793fa12e --- /dev/null +++ b/challenge-153/abigail/bc/ch-1.bc @@ -0,0 +1,26 @@ +#!/usr/bin/bc + +# +# See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 +# + +# +# Run as: bc ch-1.bc +# + +sum = 1 +fac = 1 + +print sum + +for (n = 1; n <= 9; n ++) { + fac = fac * n + sum = sum + fac + print " ", sum +} + +" +" + +halt + diff --git a/challenge-153/abigail/bc/ch-2.bc b/challenge-153/abigail/bc/ch-2.bc new file mode 100644 index 0000000000..d4f59e92e0 --- /dev/null +++ b/challenge-153/abigail/bc/ch-2.bc @@ -0,0 +1,34 @@ +#!/usr/bin/bc + +# +# See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 +# + +# +# Run as: bc ch-2.bc < input-file +# + +fac [0] = 1 +for (n = 1; n <= 9; n ++) { + fac [n] = n * fac [n - 1] +} + +while (1) { + num = read () + if (num == 0) { + break + } + n = num + sum = 0 + while (n > 0) { + sum += fac [n % 10] + n /= 10 + } + if (num == sum) { + 1 + } else { + 0 + } +} + +halt diff --git a/challenge-153/abigail/befunge-93/ch-1.bf93 b/challenge-153/abigail/befunge-93/ch-1.bf93 new file mode 100644 index 0000000000..dad23c1a52 --- /dev/null +++ b/challenge-153/abigail/befunge-93/ch-1.bf93 @@ -0,0 +1,2 @@ +< v,_@#:< "1 2 4 10 34 154 874 5914 46234 409114" +55 + > ^ diff --git a/challenge-153/abigail/c/ch-1.c b/challenge-153/abigail/c/ch-1.c new file mode 100644 index 0000000000..95fa3dcc2b --- /dev/null +++ b/challenge-153/abigail/c/ch-1.c @@ -0,0 +1,22 @@ +# include +# include +# include + +/* + * See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 + */ + +/* + * Run as: cc -o ch-1.o ch-1.c; ./ch-1.o + */ + +int main (void) { + int sum = 1; + int fac = 1; + printf ("%d", sum); + for (int n = 1; n <= 9; n ++) { + printf (" %d", sum += fac *= n); + } + printf ("\n"); + return (0); +} diff --git a/challenge-153/abigail/c/ch-2.c b/challenge-153/abigail/c/ch-2.c new file mode 100644 index 0000000000..3d76b48f10 --- /dev/null +++ b/challenge-153/abigail/c/ch-2.c @@ -0,0 +1,33 @@ +# include +# include +# include + +/* + * See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 + */ + +/* + * Run as: cc -o ch-2.o ch-2.c; ./ch-2.o < input-file + */ + +int main (void) { + int fac [10]; + int num; + + fac [0] = 1; + for (int n = 1; n <= 9; n ++) { + fac [n] = n * fac [n - 1]; + } + + while (scanf ("%d", &num) == 1) { + int n = num; + int sum = 0; + while (n > 0) { + sum += fac [n % 10]; + n /= 10; + } + printf ("%d\n", num == sum ? 1 : 0); + } + + return (0); +} diff --git a/challenge-153/abigail/cobol/ch-1.cb b/challenge-153/abigail/cobol/ch-1.cb new file mode 100644 index 0000000000..280833c6bf --- /dev/null +++ b/challenge-153/abigail/cobol/ch-1.cb @@ -0,0 +1,14 @@ +IDENTIFICATION DIVISION. +PROGRAM-ID. XXX. + +*> +*> See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 +*> + +*> +*> Run as: cobc -xF -o ch-1.o ch-1.cb; ./ch-1.o +*> + +PROCEDURE DIVISION. + DISPLAY "1 2 4 10 34 154 874 5914 46234 409114". + STOP RUN. diff --git a/challenge-153/abigail/csh/ch-1.csh b/challenge-153/abigail/csh/ch-1.csh new file mode 100644 index 0000000000..3aa3867111 --- /dev/null +++ b/challenge-153/abigail/csh/ch-1.csh @@ -0,0 +1,11 @@ +#!/bin/csh + +# +# See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 +# + +# +# Run as: csh ch-1.csh +# + +echo "1 2 4 10 34 154 874 5914 46234 409114" diff --git a/challenge-153/abigail/erlang/ch-1.erl b/challenge-153/abigail/erlang/ch-1.erl new file mode 100644 index 0000000000..ccc9ad108d --- /dev/null +++ b/challenge-153/abigail/erlang/ch-1.erl @@ -0,0 +1,15 @@ +% +% See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 +% + +% +% Run as: ln ch-1.erl ch1.erl +% erl -compile ch1 +% erl -noshell -s ch1 main -s init stop +% + +-module (ch1). +-export ([main/0]). + +main () -> + io:fwrite ("1 2 4 10 34 154 874 5914 46234 409114\n"). diff --git a/challenge-153/abigail/forth/ch-1.fs b/challenge-153/abigail/forth/ch-1.fs new file mode 100644 index 0000000000..a9dcf74662 --- /dev/null +++ b/challenge-153/abigail/forth/ch-1.fs @@ -0,0 +1,5 @@ +\ +\ See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 +\ + +.( 1 2 4 10 34 154 874 5914 46234 409114) diff --git a/challenge-153/abigail/fortran/ch-1.f90 b/challenge-153/abigail/fortran/ch-1.f90 new file mode 100644 index 0000000000..dafac52396 --- /dev/null +++ b/challenge-153/abigail/fortran/ch-1.f90 @@ -0,0 +1,12 @@ +! +! See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 +! + +! +! Run as: gfortran -o ch-1.o ch-1.f90; ./ch-1.o +! + +program ch1 + implicit none + write (*, *) "1 2 4 10 34 154 874 5914 46234 409114" +end diff --git a/challenge-153/abigail/go/ch-1.go b/challenge-153/abigail/go/ch-1.go new file mode 100644 index 0000000000..20557afe7e --- /dev/null +++ b/challenge-153/abigail/go/ch-1.go @@ -0,0 +1,25 @@ +package main + +// +// See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 +// + +// +// Run as: go run ch-1.go +// + +import ( + "fmt" +) + +func main () { + sum := 1 + fac := 1 + fmt . Printf ("%d", sum) + for n := 1; n <= 9; n ++ { + fac *= n + sum += fac + fmt . Printf (" %d", sum) + } + fmt . Printf ("\n") +} diff --git a/challenge-153/abigail/go/ch-2.go b/challenge-153/abigail/go/ch-2.go new file mode 100644 index 0000000000..cef982a6b5 --- /dev/null +++ b/challenge-153/abigail/go/ch-2.go @@ -0,0 +1,39 @@ +package main + +// +// See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 +// + +// +// Run as: go run ch-2.go < input-file +// + +import ( + "fmt" +) + +func main () { + var fac [10] int + fac [0] = 1 + for n := 1; n <= 9; n ++ { + fac [n] = n * fac [n - 1] + } + for { + var num int + c, err := fmt . Scanf ("%d", &num) + if (c != 1 || err != nil) { + break + } + n := num + sum := 0 + for n > 0 { + sum += fac [n % 10] + n /= 10 + } + if num == sum { + fmt . Printf ("1\n") + } else { + fmt . Printf ("0\n") + } + } +} diff --git a/challenge-153/abigail/java/ch-1.java b/challenge-153/abigail/java/ch-1.java new file mode 100644 index 0000000000..dd06f3b774 --- /dev/null +++ b/challenge-153/abigail/java/ch-1.java @@ -0,0 +1,23 @@ +// +// See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 +// + +// +// Run as: ln ch-1.java ch1.java; javac ch1.java; java ch1 +// + +import java.util.*; + +public class ch1 { + public static void main (String [] args) { + int sum = 1; + int fac = 1; + System . out . printf ("%d", sum); + for (int n = 1; n <= 9; n ++) { + fac *= n; + sum += fac; + System . out . printf (" %d", sum); + } + System . out . printf ("\n"); + } +} diff --git a/challenge-153/abigail/java/ch-2.java b/challenge-153/abigail/java/ch-2.java new file mode 100644 index 0000000000..1fc60b7431 --- /dev/null +++ b/challenge-153/abigail/java/ch-2.java @@ -0,0 +1,30 @@ +// +// See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 +// + +// +// Run as: ln ch-2.java ch2.java; javac ch2.java; java ch2 < input-file +// + +import java.util.*; + +public class ch2 { + public static void main (String [] args) { + Scanner scanner = new Scanner (System . in); + int [] fac = new int [10]; + fac [0] = 1; + for (int n = 1; n <= 9; n ++) { + fac [n] = n * fac [n - 1]; + } + while (scanner . hasNextInt ()) { + int num = scanner . nextInt (); + int sum = 0; + int n = num; + while (n > 0) { + sum += fac [n % 10]; + n /= 10; + } + System . out . printf ("%d\n", sum == num ? 1 : 0); + } + } +} diff --git a/challenge-153/abigail/lua/ch-1.lua b/challenge-153/abigail/lua/ch-1.lua new file mode 100644 index 0000000000..6954a9c0a0 --- /dev/null +++ b/challenge-153/abigail/lua/ch-1.lua @@ -0,0 +1,22 @@ +#!/opt/local/bin/lua + +-- +-- See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 +-- + +-- +-- Run as: lua ch-1.lua +-- + +local sum = 1 +local fac = 1 + +io . write (sum) + +for n = 1, 9 do + fac = fac * n + sum = sum + fac + io . write (" ", sum) +end + +io . write ("\n") diff --git a/challenge-153/abigail/lua/ch-2.lua b/challenge-153/abigail/lua/ch-2.lua new file mode 100644 index 0000000000..2f01225aaa --- /dev/null +++ b/challenge-153/abigail/lua/ch-2.lua @@ -0,0 +1,30 @@ +#!/opt/local/bin/lua + +-- +-- See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 +-- + +-- +-- Run as: lua ch-2.lua < input-file +-- + +local fac = {} + fac [0] = 1 + +for n = 1, 9 do + fac [n] = n * fac [n - 1] +end + +for num in io . lines () do + num = tonumber (num) + local n = num + local sum = 0 + while n > 0 do + sum = sum + fac [n % 10] + n = math . floor (n / 10) + end + if sum == num + then print (1) + else print (0) + end +end diff --git a/challenge-153/abigail/m4/ch-1.m4 b/challenge-153/abigail/m4/ch-1.m4 new file mode 100644 index 0000000000..5bad1feb2f --- /dev/null +++ b/challenge-153/abigail/m4/ch-1.m4 @@ -0,0 +1 @@ +1 2 4 10 34 154 874 5914 46234 409114 diff --git a/challenge-153/abigail/mmix/ch-1.mms b/challenge-153/abigail/mmix/ch-1.mms new file mode 100644 index 0000000000..f5e024aea1 --- /dev/null +++ b/challenge-153/abigail/mmix/ch-1.mms @@ -0,0 +1,16 @@ +% +% See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 +% + +% +% Run as: mmixal -o ch-1.mmo ch-1.mms; mmix -q ch-1.mmo +% + LOC Data_Segment + GREG @ +Text BYTE "1 2 4 10 34 154 874 5914 46234 409114",10,0 + + LOC #100 + +Main LDA $255,Text + TRAP 0,Fputs,StdOut + TRAP 0,Halt,0 diff --git a/challenge-153/abigail/node/ch-1.js b/challenge-153/abigail/node/ch-1.js new file mode 100644 index 0000000000..4db5bf8883 --- /dev/null +++ b/challenge-153/abigail/node/ch-1.js @@ -0,0 +1,20 @@ +#!/usr/local/bin/node + +// +// See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 +// + +// +// Run as: node ch-1.js +// + +let sum = 1 +let fac = 1 + +process . stdout . write (sum . toString ()) + +for (let n = 1; n <= 9; n ++) { + process . stdout . write (" " + (sum += fac *= n) . toString ()) +} + +process . stdout . write ("\n") diff --git a/challenge-153/abigail/node/ch-2.js b/challenge-153/abigail/node/ch-2.js new file mode 100644 index 0000000000..7527e75bf4 --- /dev/null +++ b/challenge-153/abigail/node/ch-2.js @@ -0,0 +1,27 @@ +#!/usr/local/bin/node + +// +// See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 +// + +// +// Run as: node ch-2.js < input-file +// + +let fac = [1] +for (let n = 1; n <= 9; n ++) { + fac [n] = n * fac [n - 1] +} + + require ('readline') +. createInterface ({input: process . stdin}) +. on ('line', line => { + let num = +line + let n = num + let sum = 0 + while (n > 0) { + sum += fac [n % 10] + n = Math . floor (n / 10) + } + console . log (num == sum ? 1 : 0) +}) diff --git a/challenge-153/abigail/ocaml/ch-1.ml b/challenge-153/abigail/ocaml/ch-1.ml new file mode 100644 index 0000000000..869035c8b8 --- /dev/null +++ b/challenge-153/abigail/ocaml/ch-1.ml @@ -0,0 +1,9 @@ +(* *) +(* See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 *) +(* *) + +(* *) +(* Run as: ocaml ch-1.ml *) +(* *) + +print_endline "1 2 4 10 34 154 874 5914 46234 409114"; diff --git a/challenge-153/abigail/pascal/ch-1.p b/challenge-153/abigail/pascal/ch-1.p new file mode 100644 index 0000000000..5d06def976 --- /dev/null +++ b/challenge-153/abigail/pascal/ch-1.p @@ -0,0 +1,25 @@ +Program ch1; + +(* *) +(* See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 *) +(* *) + +(* *) +(* Run as: fpc -och-1.out ch-1.p; ./ch-1.out *) +(* *) + +var + sum, fac: longint; + n: integer; + +begin + sum := 1; + fac := 1; + write (sum); + for n := 1 to 9 do begin + fac := fac * n; + sum := sum + fac; + write (' ', sum); + end; + writeln; +end. diff --git a/challenge-153/abigail/pascal/ch-2.p b/challenge-153/abigail/pascal/ch-2.p new file mode 100644 index 0000000000..6ca7e56638 --- /dev/null +++ b/challenge-153/abigail/pascal/ch-2.p @@ -0,0 +1,36 @@ +Program ch2; + +(* *) +(* See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 *) +(* *) + +(* *) +(* Run as: fpc -och-2.out ch-2.p; ./ch-2.out < input-file *) +(* *) + +var + fac: array [0 .. 9] of longint; + n: integer; + num, sum: longint; + +begin + fac [0] := 1; + for n := 1 to 9 do begin + fac [n] := n * fac [n - 1]; + end; + + while not eof do begin + readln (num); + n := num; + while n > 0 do begin + sum := sum + fac [n mod 10]; + n := n div 10; + end; + if num = sum then begin + writeln (1); + end + else begin + writeln (0); + end; + end +end. diff --git a/challenge-153/abigail/perl/ch-1.pl b/challenge-153/abigail/perl/ch-1.pl new file mode 100644 index 0000000000..00f93d6226 --- /dev/null +++ b/challenge-153/abigail/perl/ch-1.pl @@ -0,0 +1,23 @@ +#!/opt/perl/bin/perl + +use 5.032; + +use strict; +use warnings; +no warnings 'syntax'; + +use experimental 'signatures'; +use experimental 'lexical_subs'; + +# +# See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 +# + +# +# Run as: perl ch-1.pl +# + +# Calculate factorials, and sum them. +print my $sum = my $fac = 1; +print ' ', $sum += $fac *= $_ for 1 .. 9; +print "\n"; diff --git a/challenge-153/abigail/perl/ch-2.pl b/challenge-153/abigail/perl/ch-2.pl new file mode 100644 index 0000000000..620a0e0de3 --- /dev/null +++ b/challenge-153/abigail/perl/ch-2.pl @@ -0,0 +1,26 @@ +#!/opt/perl/bin/perl + +use 5.032; + +use strict; +use warnings; +no warnings 'syntax'; + +use experimental 'signatures'; +use experimental 'lexical_subs'; + +# +# See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 +# + +# +# Run as: perl ch-2.pl < input-file +# + +use List::Util qw [sum]; + +# Preprocess factorials +my @fac = (1); $fac [$_] = $_ * $fac [$_ - 1] for 1 .. 8; + +# Sum factorials of digits, and compare. +say +($_ == sum map {$fac [$_]} /[0-9]/g) ? 1 : 0 while <>; diff --git a/challenge-153/abigail/php/ch-1.php b/challenge-153/abigail/php/ch-1.php new file mode 100644 index 0000000000..df633cd5fa --- /dev/null +++ b/challenge-153/abigail/php/ch-1.php @@ -0,0 +1,11 @@ + diff --git a/challenge-153/abigail/postscript/ch-1.ps b/challenge-153/abigail/postscript/ch-1.ps new file mode 100644 index 0000000000..4c1581b50a --- /dev/null +++ b/challenge-153/abigail/postscript/ch-1.ps @@ -0,0 +1,10 @@ +%!PS +% +% See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 +% + +% +% Run as: ps2ascii ch-1.ps +% + +(1 2 4 10 34 154 874 5914 46234 409114) = diff --git a/challenge-153/abigail/python/ch-1.py b/challenge-153/abigail/python/ch-1.py new file mode 100644 index 0000000000..6f287fa129 --- /dev/null +++ b/challenge-153/abigail/python/ch-1.py @@ -0,0 +1,23 @@ +#!/usr/local/bin/python3 + +# +# See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 +# + +# +# Run as: python ch-1.py +# + +import sys; + +fac = 1 +sum = 1 + +sys . stdout . write (str (sum)) + +for n in range (1, 10): + fac = fac * n + sum = sum + fac + sys . stdout . write (" " + str (sum)) + +sys . stdout . write ("\n") diff --git a/challenge-153/abigail/python/ch-2.py b/challenge-153/abigail/python/ch-2.py new file mode 100644 index 0000000000..693eeffe7f --- /dev/null +++ b/challenge-153/abigail/python/ch-2.py @@ -0,0 +1,28 @@ +#!/usr/local/bin/python3 + +# +# See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 +# + +# +# Run as: python ch-2.py < input-file +# + +import fileinput + +fac = [1] * 10 +for n in range (1, 10): + fac [n] = n * fac [n - 1] + +for line in fileinput . input (): + num = int (line) + sum = 0 + n = num + while n > 0: + sum = sum + fac [n % 10] + n = n // 10 + + if num == sum: + print (1) + else: + print (0) diff --git a/challenge-153/abigail/r/ch-1.r b/challenge-153/abigail/r/ch-1.r new file mode 100644 index 0000000000..d4b433ac87 --- /dev/null +++ b/challenge-153/abigail/r/ch-1.r @@ -0,0 +1,22 @@ +#!/usr/local/bin/Rscript + +# +# See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 +# + +# +# Run as: Rscript ch-1.r +# + +sum <- 1 +fac <- 1 + +cat (sum) + +for (n in 1 : 9) { + fac <- fac * n + sum <- sum + fac + cat ("", sum) +} + +cat ("\n") diff --git a/challenge-153/abigail/r/ch-2.r b/challenge-153/abigail/r/ch-2.r new file mode 100644 index 0000000000..8ddf0d98fa --- /dev/null +++ b/challenge-153/abigail/r/ch-2.r @@ -0,0 +1,34 @@ +#!/usr/local/bin/Rscript + +# +# See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 +# + +# +# Run as: Rscript ch-2.r < input-file +# + +fac <- c (1) +for (n in 1 : 9) { + fac <- c (fac, n * fac [[n]]) +} + +stdin <- file ('stdin', 'r') +repeat { + num <- readLines (stdin, n = 1) + if (length (num) == 0) { + break + } + num <- as.integer (num) + sum <- 0 + n <- num + while (n > 0) { + sum <- sum + fac [[1 + (n %% 10)]] + n <- n %/% 10 + } + if (num == sum) { + cat (1, "\n") + } else { + cat (0, "\n") + } +} diff --git a/challenge-153/abigail/rexx/ch-1.rexx b/challenge-153/abigail/rexx/ch-1.rexx new file mode 100644 index 0000000000..93b9f4b6be --- /dev/null +++ b/challenge-153/abigail/rexx/ch-1.rexx @@ -0,0 +1,9 @@ +/* + * See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 + */ + +/* + * Run as: rexx ch-1.rexx + */ + +say "1 2 4 10 34 154 874 5914 46234 409114" diff --git a/challenge-153/abigail/ruby/ch-1.rb b/challenge-153/abigail/ruby/ch-1.rb new file mode 100644 index 0000000000..7d5d17441c --- /dev/null +++ b/challenge-153/abigail/ruby/ch-1.rb @@ -0,0 +1,15 @@ +#!/usr/bin/ruby + +# +# See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 +# + +# +# Run as: ruby ch-1.rb +# + +print sum = fac = 1 +for n in 1 .. 9 do + print " ", sum += fac *= n +end +print "\n" diff --git a/challenge-153/abigail/ruby/ch-2.rb b/challenge-153/abigail/ruby/ch-2.rb new file mode 100644 index 0000000000..459642da7a --- /dev/null +++ b/challenge-153/abigail/ruby/ch-2.rb @@ -0,0 +1,30 @@ +#!/usr/bin/ruby + +# +# See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 +# + +# +# Run as: ruby ch-2.rb < input-file +# + +fac = [] +fac [0] = 1 +for n in 1 .. 9 do + fac [n] = n * fac [n - 1] +end + +ARGF . each_line do |num| + num = num . to_i + sum = 0 + n = num + while n > 0 do + sum += fac[n % 10] + n /= 10 + end + if sum == num then + puts (1) + else + puts (0) + end +end diff --git a/challenge-153/abigail/scheme/ch-1.scm b/challenge-153/abigail/scheme/ch-1.scm new file mode 100644 index 0000000000..97a03bc8fa --- /dev/null +++ b/challenge-153/abigail/scheme/ch-1.scm @@ -0,0 +1,23 @@ +#!/usr/local/bin/guile +!# + +;;; +;;; See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 +;;; + +;;; +;;; Run as: guile --no-auto-compile ch-1.scm +;;; + + +(use-modules (ice-9 rdelim)) + +(define (main max sum fac n) + (if (> max 0) + (begin + (display sum) + (display " ") + (main (- max 1) (+ sum (* n fac)) (* fac n) (+ n 1))))) + +(main 10 1 1 1) +(newline) diff --git a/challenge-153/abigail/scheme/ch-2.scm b/challenge-153/abigail/scheme/ch-2.scm new file mode 100644 index 0000000000..038d2886f5 --- /dev/null +++ b/challenge-153/abigail/scheme/ch-2.scm @@ -0,0 +1,35 @@ +#!/usr/local/bin/guile +!# + +;;; +;;; See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 +;;; + +;;; +;;; Run as: guile --no-auto-compile ch-1.scm +;;; + + +(use-modules (ice-9 rdelim)) + +(define (fac n) + (cond ((= n 0) 1) + (else (* n (fac (- n 1)))))) + +(define (sum num) + (cond ((= num 0) 0) + (else (+ (fac (modulo num 10)) (sum (floor/ num 10)))))) + +(define (check num) + (if (= num (sum num)) + (display "1\n") + (display "0\n"))) + +(define (main) + (define line (read-line)) + (if (not (eof-object? line)) + (begin + (check (string->number line)) + (main)))) + +(main) diff --git a/challenge-153/abigail/sed/ch-1.sed b/challenge-153/abigail/sed/ch-1.sed new file mode 100644 index 0000000000..7449f412be --- /dev/null +++ b/challenge-153/abigail/sed/ch-1.sed @@ -0,0 +1,12 @@ +# +# See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 +# + +# +# Run as: sed -f ch-1.sed +# +# For each line in the input file, we write the first three +# self-describing numbers. +# + +s/.*/1 2 4 10 34 154 874 5914 46234 409114/ diff --git a/challenge-153/abigail/sql/ch-1.sql b/challenge-153/abigail/sql/ch-1.sql new file mode 100644 index 0000000000..d759025227 --- /dev/null +++ b/challenge-153/abigail/sql/ch-1.sql @@ -0,0 +1,9 @@ +-- +-- See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 +-- + +-- +-- Run as: sqlite3 < ch-1.sql +-- + +SELECT "1 2 4 10 34 154 874 5914 46234 409114"; diff --git a/challenge-153/abigail/t/ctest.ini b/challenge-153/abigail/t/ctest.ini new file mode 100644 index 0000000000..d96830e751 --- /dev/null +++ b/challenge-153/abigail/t/ctest.ini @@ -0,0 +1,11 @@ +# +# Configuration file for running tests, using ctest. +# See https://github.com/Abigail/Misc/blob/master/ctest +# + +[names] +1-1 = Fixed Output +2-1 = Given Examples + +[2-1/bc] +add_to_input = 0 diff --git a/challenge-153/abigail/t/input-1-1 b/challenge-153/abigail/t/input-1-1 new file mode 100644 index 0000000000..8d1c8b69c3 --- /dev/null +++ b/challenge-153/abigail/t/input-1-1 @@ -0,0 +1 @@ + diff --git a/challenge-153/abigail/t/input-2-1 b/challenge-153/abigail/t/input-2-1 new file mode 100644 index 0000000000..ca960b47da --- /dev/null +++ b/challenge-153/abigail/t/input-2-1 @@ -0,0 +1,2 @@ +145 +125 diff --git a/challenge-153/abigail/t/output-1-1.exp b/challenge-153/abigail/t/output-1-1.exp new file mode 100644 index 0000000000..5bad1feb2f --- /dev/null +++ b/challenge-153/abigail/t/output-1-1.exp @@ -0,0 +1 @@ +1 2 4 10 34 154 874 5914 46234 409114 diff --git a/challenge-153/abigail/t/output-2-1.exp b/challenge-153/abigail/t/output-2-1.exp new file mode 100644 index 0000000000..b261da18d5 --- /dev/null +++ b/challenge-153/abigail/t/output-2-1.exp @@ -0,0 +1,2 @@ +1 +0 diff --git a/challenge-153/abigail/tcl/ch-1.tcl b/challenge-153/abigail/tcl/ch-1.tcl new file mode 100644 index 0000000000..9ea22c3da2 --- /dev/null +++ b/challenge-153/abigail/tcl/ch-1.tcl @@ -0,0 +1,21 @@ +#!/usr/local/opt/tcl-tk/bin/tclsh + +# +# See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 +# + +# +# Run as: tclsh ch-1.tcl +# + +set sum 1 +set fac 1 +puts -nonewline $sum + +for {set n 1} {$n <= 9} {incr n} { + set fac [expr $fac * $n] + set sum [expr $sum + $fac] + puts -nonewline " ${sum}" +} + +puts "" diff --git a/challenge-153/abigail/tcl/ch-2.tcl b/challenge-153/abigail/tcl/ch-2.tcl new file mode 100644 index 0000000000..05299954e6 --- /dev/null +++ b/challenge-153/abigail/tcl/ch-2.tcl @@ -0,0 +1,24 @@ +#!/usr/local/opt/tcl-tk/bin/tclsh + +# +# See https://theweeklychallenge.org/blog/perl-weekly-challenge-153 +# + +# +# Run as: tclsh ch-2.tcl < input-file +# + +set fac [list 1] +for {set n 1} {$n <= 9} {incr n} { + lset fac $n [expr $n * [lindex $fac [expr $n - 1]]] +} + +while {[gets stdin num] >= 0} { + set sum 0 + set n $num + while {$n > 0} { + set sum [expr $sum + [lindex $fac [expr $n % 10]]] + set n [expr int ($n / 10)] + } + puts [expr $sum == $num ? 1 : 0] +} -- cgit From fa79f4e07e46cabac7610d2582e77f897d2db55c Mon Sep 17 00:00:00 2001 From: Luca Ferrari Date: Mon, 21 Feb 2022 15:53:59 +0100 Subject: Blog references --- challenge-153/luca-ferrari/blog-1.txt | 1 + challenge-153/luca-ferrari/blog-2.txt | 1 + 2 files changed, 2 insertions(+) create mode 100644 challenge-153/luca-ferrari/blog-1.txt create mode 100644 challenge-153/luca-ferrari/blog-2.txt diff --git a/challenge-153/luca-ferrari/blog-1.txt b/challenge-153/luca-ferrari/blog-1.txt new file mode 100644 index 0000000000..774fb793c5 --- /dev/null +++ b/challenge-153/luca-ferrari/blog-1.txt @@ -0,0 +1 @@ +https://fluca1978.github.io/2022/02/21/PerlWeeklyChallenge153.html#task1 diff --git a/challenge-153/luca-ferrari/blog-2.txt b/challenge-153/luca-ferrari/blog-2.txt new file mode 100644 index 0000000000..06b4f03159 --- /dev/null +++ b/challenge-153/luca-ferrari/blog-2.txt @@ -0,0 +1 @@ +https://fluca1978.github.io/2022/02/21/PerlWeeklyChallenge153.html#task2 -- cgit From ee0a397b06a70ee0bc5aaf061831bb83293d270e Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Mon, 21 Feb 2022 16:34:38 +0000 Subject: - Added contributions by Roger Bell_West. --- stats/pwc-challenge-152.json | 510 +++++++++++++ stats/pwc-current.json | 517 +------------- stats/pwc-language-breakdown-summary.json | 60 +- stats/pwc-language-breakdown.json | 1099 +++++++++++++++-------------- stats/pwc-leaders.json | 356 +++++----- stats/pwc-summary-1-30.json | 34 +- stats/pwc-summary-121-150.json | 100 +-- stats/pwc-summary-151-180.json | 110 +-- stats/pwc-summary-181-210.json | 56 +- stats/pwc-summary-211-240.json | 102 +-- stats/pwc-summary-241-270.json | 52 +- stats/pwc-summary-31-60.json | 108 +-- stats/pwc-summary-61-90.json | 100 +-- stats/pwc-summary-91-120.json | 90 +-- stats/pwc-summary.json | 538 +++++++------- 15 files changed, 1961 insertions(+), 1871 deletions(-) create mode 100644 stats/pwc-challenge-152.json diff --git a/stats/pwc-challenge-152.json b/stats/pwc-challenge-152.json new file mode 100644 index 0000000000..6a73b7a5f6 --- /dev/null +++ b/stats/pwc-challenge-152.json @@ -0,0 +1,510 @@ +{ + "chart" : { + "type" : "column" + }, + "legend" : { + "enabled" : 0 + }, + "series" : [ + { + "data" : [ + { + "y" : 2, + "name" : "Abigail", + "drilldown" : "Abigail" + }, + { + "y" : 4, + "drilldown" : "Alexander Pankoff", + "name" : "Alexander Pankoff" + }, + { + "name" : "Arne Sommer", + "drilldown" : "Arne Sommer", + "y" : 3 + }, + { + "name" : "Athanasius", + "drilldown" : "Athanasius", + "y" : 4 + }, + { + "y" : 1, + "drilldown" : "Cheok-Yin Fung", + "name" : "Cheok-Yin Fung" + }, + { + "y" : 6, + "name" : "Colin Crain", + "drilldown" : "Colin Crain" + }, + { + "drilldown" : "Dave Jacoby", + "name" : "Dave Jacoby", + "y" : 4 + }, + { + "y" : 2, + "name" : "Duncan C. White", + "drilldown" : "Duncan C. White" + }, + { + "y" : 2, + "name" : "E. Choroba"