aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrbaggy <js5@sanger.ac.uk>2021-07-03 07:26:35 +0100
committerdrbaggy <js5@sanger.ac.uk>2021-07-03 07:26:35 +0100
commit0913d91b83f7050803480c346878b4752e986116 (patch)
tree72bb83d9aa22d1cd75473d0b849eff135060d1e7
parent5e37fb5eb893b70de52be7da6e8bfc1d402610d4 (diff)
parent43b27153c554a1803df441769d16149997394728 (diff)
downloadperlweeklychallenge-club-0913d91b83f7050803480c346878b4752e986116.tar.gz
perlweeklychallenge-club-0913d91b83f7050803480c346878b4752e986116.tar.bz2
perlweeklychallenge-club-0913d91b83f7050803480c346878b4752e986116.zip
Merge remote-tracking branch 'upstream/master'
-rw-r--r--challenge-012/paulo-custodio/c/ch-1.c51
-rw-r--r--challenge-012/paulo-custodio/cpp/ch-1.cpp50
-rw-r--r--challenge-012/paulo-custodio/t/test-1.yaml5
-rw-r--r--challenge-012/paulo-custodio/t/test-2.yaml15
-rw-r--r--challenge-012/paulo-custodio/test.pl39
-rwxr-xr-xchallenge-117/e-choroba/perl/ch-1.pl (renamed from challenge-117/e-choroba/perl5/ch-1.pl)0
-rwxr-xr-xchallenge-117/e-choroba/perl/ch-2.pl (renamed from challenge-117/e-choroba/perl5/ch-2.pl)0
-rwxr-xr-xchallenge-117/perlboy1967/perl/ch-1.pl5
-rw-r--r--challenge-118/paulo-custodio/c/ch-1.c55
-rw-r--r--challenge-118/paulo-custodio/c/ch-2.c276
-rw-r--r--challenge-118/paulo-custodio/cpp/ch-1.cpp52
-rw-r--r--challenge-118/paulo-custodio/cpp/ch-2.cpp282
-rw-r--r--challenge-118/paulo-custodio/d/ch_1.d44
-rw-r--r--challenge-118/paulo-custodio/d/ch_2.d269
-rw-r--r--challenge-119/abigail/README.md87
-rw-r--r--challenge-119/abigail/awk/ch-1.awk15
-rw-r--r--challenge-119/abigail/awk/ch-2.awk51
-rw-r--r--challenge-119/abigail/bash/ch-1.sh17
-rw-r--r--challenge-119/abigail/c/ch-1.c23
-rw-r--r--challenge-119/abigail/c/ch-2.c57
-rw-r--r--challenge-119/abigail/go/ch-1.go26
-rw-r--r--challenge-119/abigail/java/ch-1.java28
-rw-r--r--challenge-119/abigail/lua/ch-1.lua16
-rw-r--r--challenge-119/abigail/lua/ch-2.lua36
-rw-r--r--challenge-119/abigail/mmix/ch-2.mms16
-rw-r--r--challenge-119/abigail/node/ch-1.js17
-rw-r--r--challenge-119/abigail/node/ch-2.js39
-rw-r--r--challenge-119/abigail/perl/ch-1.pl31
-rw-r--r--challenge-119/abigail/perl/ch-2.pl37
-rw-r--r--challenge-119/abigail/python/ch-1.py17
-rw-r--r--challenge-119/abigail/ruby/ch-1.rb17
-rw-r--r--challenge-119/abigail/t/ctest.ini9
-rw-r--r--challenge-119/abigail/t/input-1-12
-rw-r--r--challenge-119/abigail/t/input-1-2255
-rw-r--r--challenge-119/abigail/t/input-2-13
-rw-r--r--challenge-119/abigail/t/output-1-1.exp2
-rw-r--r--challenge-119/abigail/t/output-1-2.exp255
-rw-r--r--challenge-119/abigail/t/output-2-1.exp3
-rwxr-xr-xchallenge-119/adherzog/perl/ch-1.pl64
-rwxr-xr-xchallenge-119/adherzog/perl/ch-2.pl78
-rw-r--r--challenge-119/belmark-caday/README1
-rw-r--r--challenge-119/colin-crain/blog.txt1
-rw-r--r--challenge-119/duane-powell/perl/ch-1.pl64
-rw-r--r--challenge-119/duane-powell/perl/ch-2.pl55
-rwxr-xr-xchallenge-119/e-choroba/perl/ch-1.pl17
-rwxr-xr-xchallenge-119/e-choroba/perl/ch-2.pl108
-rw-r--r--challenge-119/eric-cheung/README1
-rw-r--r--challenge-119/eric-cheung/excel-vba/ch-1.xlsmbin0 -> 29547 bytes
-rw-r--r--challenge-119/eric-cheung/excel-vba/ch-2.xlsmbin0 -> 29547 bytes
-rw-r--r--challenge-119/frankivo/scala/NibbleSwap.scala12
-rw-r--r--challenge-119/frankivo/scala/Sequencer.scala10
-rw-r--r--challenge-119/laurent-rosenfeld/blog.txt1
-rw-r--r--challenge-119/laurent-rosenfeld/perl/ch-1.pl19
-rw-r--r--challenge-119/laurent-rosenfeld/perl/ch-2.pl6
-rw-r--r--challenge-119/laurent-rosenfeld/raku/ch-1.raku9
-rw-r--r--challenge-119/laurent-rosenfeld/raku/ch-2.raku5
-rw-r--r--challenge-119/mark-anderson/raku/ch-2.raku6
-rw-r--r--challenge-119/olivier-delouya/README1
-rw-r--r--challenge-119/olivier-delouya/perl/ch-1.sh1
-rw-r--r--challenge-119/paul-fajman/README1
-rw-r--r--challenge-119/paulo-custodio/ada/ch_1.adb37
-rw-r--r--challenge-119/paulo-custodio/ada/ch_2.adb68
-rw-r--r--challenge-119/paulo-custodio/awk/ch-1.awk34
-rw-r--r--challenge-119/paulo-custodio/awk/ch-2.awk40
-rw-r--r--challenge-119/paulo-custodio/basic/ch-1.bas30
-rw-r--r--challenge-119/paulo-custodio/basic/ch-2.bas50
-rw-r--r--challenge-119/paulo-custodio/bc/ch-1.bc34
-rw-r--r--challenge-119/paulo-custodio/bc/ch-2.bc55
-rw-r--r--challenge-119/paulo-custodio/c/ch-1.c37
-rw-r--r--challenge-119/paulo-custodio/c/ch-2.c60
-rw-r--r--challenge-119/paulo-custodio/cpp/ch-1.cpp37
-rw-r--r--challenge-119/paulo-custodio/cpp/ch-2.cpp59
-rw-r--r--challenge-119/paulo-custodio/d/ch_1.d36
-rw-r--r--challenge-119/paulo-custodio/d/ch_2.d58
-rw-r--r--challenge-119/paulo-custodio/forth/ch-1.fs34
-rw-r--r--challenge-119/paulo-custodio/forth/ch-2.fs48
-rw-r--r--challenge-119/paulo-custodio/lua/ch-1.lua33
-rw-r--r--challenge-119/paulo-custodio/lua/ch-2.lua41
-rw-r--r--challenge-119/paulo-custodio/perl/ch-1.pl31
-rw-r--r--challenge-119/paulo-custodio/perl/ch-2.pl37
-rw-r--r--challenge-119/paulo-custodio/python/ch-1.py32
-rw-r--r--challenge-119/paulo-custodio/python/ch-2.py35
-rw-r--r--challenge-119/paulo-custodio/t/test-1.yaml20
-rw-r--r--challenge-119/paulo-custodio/t/test-2.yaml30
-rw-r--r--challenge-119/paulo-custodio/test.pl4
-rw-r--r--challenge-119/roger-bell-west/blog.txt1
-rw-r--r--challenge-119/sgreen/README.md4
-rw-r--r--challenge-119/sgreen/blog.txt1
-rwxr-xr-xchallenge-119/sgreen/perl/ch-1.pl18
-rwxr-xr-xchallenge-119/sgreen/perl/ch-2.pl22
-rwxr-xr-xchallenge-119/steven-wilson/perl/ch-2.pl27
-rw-r--r--challenge-119/steven-wilson/python/ch-2.py24
-rw-r--r--challenge-119/vinod-k/perl/ch-1.pl15
-rwxr-xr-xchallenge-119/wlmb/perl/ch-2a.pl27
-rw-r--r--guests.json1
-rw-r--r--members.json3
-rw-r--r--stats/pwc-current.json308
-rw-r--r--stats/pwc-language-breakdown-summary.json68
-rw-r--r--stats/pwc-language-breakdown.json892
-rw-r--r--stats/pwc-leaders.json754
-rw-r--r--stats/pwc-summary-1-30.json132
-rw-r--r--stats/pwc-summary-121-150.json58
-rw-r--r--stats/pwc-summary-151-180.json140
-rw-r--r--stats/pwc-summary-181-210.json84
-rw-r--r--stats/pwc-summary-211-240.json106
-rw-r--r--stats/pwc-summary-31-60.json128
-rw-r--r--stats/pwc-summary-61-90.json56
-rw-r--r--stats/pwc-summary-91-120.json138
-rw-r--r--stats/pwc-summary.json66
109 files changed, 5233 insertions, 1482 deletions
diff --git a/challenge-012/paulo-custodio/c/ch-1.c b/challenge-012/paulo-custodio/c/ch-1.c
new file mode 100644
index 0000000000..967109929d
--- /dev/null
+++ b/challenge-012/paulo-custodio/c/ch-1.c
@@ -0,0 +1,51 @@
+/*
+Challenge 012
+
+Challenge #1
+The numbers formed by adding one to the products of the smallest primes are
+called the Euclid Numbers (see wiki). Write a script that finds the smallest
+Euclid Number that is not prime. This challenge was proposed by
+Laurent Rosenfeld.
+*/
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+bool is_prime(int n) {
+ if (n <= 1)
+ return false;
+ if (n <= 3)
+ return true;
+ if ((n % 2) == 0 || (n % 3) == 0)
+ return false;
+ for (int i = 5; i * i <= n; i += 6)
+ if ((n % i) == 0 || (n % (i + 2)) == 0)
+ return false;
+ return true;
+}
+
+int next_prime(int n) {
+ if (n <= 1)
+ return 2;
+ do {
+ n++;
+ } while (!is_prime(n));
+ return n;
+}
+
+int next_euclid(void) {
+ static int prime = 1;
+ static int prime_prod = 1;
+
+ prime = next_prime(prime);
+ prime_prod *= prime;
+ return prime_prod + 1;
+}
+
+int main(void) {
+ int euclid;
+ while (is_prime(euclid = next_euclid()))
+ ;
+ printf("%d\n", euclid);
+}
diff --git a/challenge-012/paulo-custodio/cpp/ch-1.cpp b/challenge-012/paulo-custodio/cpp/ch-1.cpp
new file mode 100644
index 0000000000..b18ecaaa19
--- /dev/null
+++ b/challenge-012/paulo-custodio/cpp/ch-1.cpp
@@ -0,0 +1,50 @@
+/*
+Challenge 012
+
+Challenge #1
+The numbers formed by adding one to the products of the smallest primes are
+called the Euclid Numbers (see wiki). Write a script that finds the smallest
+Euclid Number that is not prime. This challenge was proposed by
+Laurent Rosenfeld.
+*/
+
+#include <iostream>
+using namespace std;
+
+bool is_prime(int n) {
+ if (n <= 1)
+ return false;
+ if (n <= 3)
+ return true;
+ if ((n % 2) == 0 || (n % 3) == 0)
+ return false;
+ for (int i = 5; i * i <= n; i += 6)
+ if ((n % i) == 0 || (n % (i + 2)) == 0)
+ return false;
+ return true;
+}
+
+int next_prime(int n) {
+ if (n <= 1)
+ return 2;
+ do {
+ n++;
+ } while (!is_prime(n));
+ return n;
+}
+
+int next_euclid(void) {
+ static int prime = 1;
+ static int prime_prod = 1;
+
+ prime = next_prime(prime);
+ prime_prod *= prime;
+ return prime_prod + 1;
+}
+
+int main(void) {
+ int euclid;
+ while (is_prime(euclid = next_euclid()))
+ ;
+ cout << euclid << endl;
+}
diff --git a/challenge-012/paulo-custodio/t/test-1.yaml b/challenge-012/paulo-custodio/t/test-1.yaml
new file mode 100644
index 0000000000..adaf9beab6
--- /dev/null
+++ b/challenge-012/paulo-custodio/t/test-1.yaml
@@ -0,0 +1,5 @@
+- setup:
+ cleanup:
+ args:
+ input:
+ output: 30031
diff --git a/challenge-012/paulo-custodio/t/test-2.yaml b/challenge-012/paulo-custodio/t/test-2.yaml
new file mode 100644
index 0000000000..975c4a1c90
--- /dev/null
+++ b/challenge-012/paulo-custodio/t/test-2.yaml
@@ -0,0 +1,15 @@
+- setup:
+ cleanup:
+ args: / /a/b/c/d /a/b/cd /a/b/cc /a/b/c/d/e
+ input:
+ output: /a/b
+- setup:
+ cleanup:
+ args: ": :a:b:c:d :a:b:cd :a:b:cc :a:b:c:d:e"
+ input:
+ output: ":a:b"
+- setup:
+ cleanup:
+ args: / /b/c/d /a/b/c/d /a/b/cd /a/b/cc /a/b/c/d/e
+ input:
+ output:
diff --git a/challenge-012/paulo-custodio/test.pl b/challenge-012/paulo-custodio/test.pl
index db440a3a8f..ba6c37260b 100644
--- a/challenge-012/paulo-custodio/test.pl
+++ b/challenge-012/paulo-custodio/test.pl
@@ -1,37 +1,4 @@
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-use 5.030;
+#!/usr/bin/env perl
+use Modern::Perl;
use Test::More;
-
-is capture("perl perl/ch-1.pl"), "30031\n";
-
-is capture("perl perl/ch-2.pl / ".
- " /a/b/c/d ".
- " /a/b/cd ".
- " /a/b/cc ".
- " /a/b/c/d/e "), "/a/b\n";
-
-is capture("perl perl/ch-2.pl : ".
- " :a:b:c:d ".
- " :a:b:cd ".
- " :a:b:cc ".
- " :a:b:c:d:e "), ":a:b\n";
-
-is capture("perl perl/ch-2.pl / ".
- " /b/c/d ".
-