diff options
| -rw-r--r-- | challenge-022/simon-proctor/perl6/ch-1.p6 | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/challenge-022/simon-proctor/perl6/ch-1.p6 b/challenge-022/simon-proctor/perl6/ch-1.p6 new file mode 100644 index 0000000000..d1539fe771 --- /dev/null +++ b/challenge-022/simon-proctor/perl6/ch-1.p6 @@ -0,0 +1,13 @@ +#!/usr/bin/env perl6 + +use v6; + +#| Usage notes +multi sub MAIN ( :h(:$help) ) { say $*USAGE } + +#| Calculate the first n paris of "sexy" primes (being two primes seperated by 6) +multi sub MAIN ( + UInt $n = 10 #= Number to calculate +) { + .say for (^Inf).hyper.grep( { $_.is-prime && ($_ + 6).is-prime } ).map( { ($_,$_+6).join(",") } )[^$n]; +} |
