diff options
| author | Doomtrain14 <yet.ebreo@gmail.com> | 2019-08-19 23:51:25 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-08-19 23:51:25 +0800 |
| commit | f2493cd5e01aaefc1ef7b1bf64e9ef6129ae5f8a (patch) | |
| tree | ab71483f05495672edf409de736506579752c4cc | |
| parent | b7faea994bee2e92ef532bfbd866ef61aafa0737 (diff) | |
| download | perlweeklychallenge-club-f2493cd5e01aaefc1ef7b1bf64e9ef6129ae5f8a.tar.gz perlweeklychallenge-club-f2493cd5e01aaefc1ef7b1bf64e9ef6129ae5f8a.tar.bz2 perlweeklychallenge-club-f2493cd5e01aaefc1ef7b1bf64e9ef6129ae5f8a.zip | |
Create ch-1.pl
Added perl5 solution for challenge #1
| -rw-r--r-- | challenge-022/yet-ebreo/perl5/ch-1.pl | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/challenge-022/yet-ebreo/perl5/ch-1.pl b/challenge-022/yet-ebreo/perl5/ch-1.pl new file mode 100644 index 0000000000..b0a1bae4a4 --- /dev/null +++ b/challenge-022/yet-ebreo/perl5/ch-1.pl @@ -0,0 +1,7 @@ +# Write a script to print first 10 Sexy Prime Pairs. +# Sexy primes are prime numbers that differ from each other by 6. +# For example, the numbers 5 and 11 are both sexy primes, because 11 - 5 = 6. +# The term “sexy prime” is a pun stemming from the Latin word for six: sex. + +@_=grep{@_[ map $x*$_,//..@_/($x=$_) ] =0 if $_[$_] > 1}@_=0..54; +map { ($_[$_]-$_[$'] == 6) && print "$_[$'] $_[$_]\n" for $_+//..$#_ } 0..$#_; |
