From a1160c7179238737c95fc2dd8fdf72d6c4610b68 Mon Sep 17 00:00:00 2001 From: Francis Whittle Date: Mon, 15 Apr 2019 10:46:30 +1000 Subject: Challenge 004.1 solution --- challenge-004/fjwhittle/perl6/ch-1.p6 | 1 + 1 file changed, 1 insertion(+) create mode 100644 challenge-004/fjwhittle/perl6/ch-1.p6 diff --git a/challenge-004/fjwhittle/perl6/ch-1.p6 b/challenge-004/fjwhittle/perl6/ch-1.p6 new file mode 100644 index 0000000000..7d60b2b87e --- /dev/null +++ b/challenge-004/fjwhittle/perl6/ch-1.p6 @@ -0,0 +1 @@ +printf "%.16f",pi \ No newline at end of file -- cgit From 3433662b2e77d72d895a03aaaa34146317b72be5 Mon Sep 17 00:00:00 2001 From: Francis Whittle Date: Mon, 15 Apr 2019 22:38:30 +1000 Subject: Redo challenge 004 part 1 with pi calculation --- challenge-004/fjwhittle/perl6/ch-1--first.p6 | 1 + challenge-004/fjwhittle/perl6/ch-1.p6 | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 challenge-004/fjwhittle/perl6/ch-1--first.p6 diff --git a/challenge-004/fjwhittle/perl6/ch-1--first.p6 b/challenge-004/fjwhittle/perl6/ch-1--first.p6 new file mode 100644 index 0000000000..7d60b2b87e --- /dev/null +++ b/challenge-004/fjwhittle/perl6/ch-1--first.p6 @@ -0,0 +1 @@ +printf "%.16f",pi \ No newline at end of file diff --git a/challenge-004/fjwhittle/perl6/ch-1.p6 b/challenge-004/fjwhittle/perl6/ch-1.p6 index 7d60b2b87e..3ae01ddb41 100644 --- a/challenge-004/fjwhittle/perl6/ch-1.p6 +++ b/challenge-004/fjwhittle/perl6/ch-1.p6 @@ -1 +1,8 @@ -printf "%.16f",pi \ No newline at end of file +my $eu-seq = gather { + take 1; + for 1..* -> $n { take $eu-seq[$n - 1] * FatRat.new($n, 2 * $n + 1) } +} + +my \π := 2 * [+] $eu-seq[^608]; + +put π.Str.substr: ^($?FILE.IO.s+1); -- cgit From f8aeea6b0a63b0c0983ec66c799c7b35052ed142 Mon Sep 17 00:00:00 2001 From: Francis Whittle Date: Mon, 15 Apr 2019 23:56:08 +1000 Subject: Add blog link for challenge 004 --- challenge-004/fjwhittle/blog.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 challenge-004/fjwhittle/blog.txt diff --git a/challenge-004/fjwhittle/blog.txt b/challenge-004/fjwhittle/blog.txt new file mode 100644 index 0000000000..55e8085e45 --- /dev/null +++ b/challenge-004/fjwhittle/blog.txt @@ -0,0 +1 @@ +https://rage.powered.ninja/2019/04/15/no-pi-file.html -- cgit