diff options
| author | 冯昶 <seaker@qq.com> | 2021-11-01 16:40:13 +0800 |
|---|---|---|
| committer | 冯昶 <seaker@qq.com> | 2021-11-01 16:40:13 +0800 |
| commit | 543bce7e79f1e0c39b2755dd52962b409c7c15d0 (patch) | |
| tree | ea0d9898a4c1c477e7542f7bb75e88233299a5b5 | |
| parent | 47c592ce79003fa05dc7f2d5d1f22c5ef2ff1b4e (diff) | |
| download | perlweeklychallenge-club-543bce7e79f1e0c39b2755dd52962b409c7c15d0.tar.gz perlweeklychallenge-club-543bce7e79f1e0c39b2755dd52962b409c7c15d0.tar.bz2 perlweeklychallenge-club-543bce7e79f1e0c39b2755dd52962b409c7c15d0.zip | |
challenge 137, raku solutions
| -rwxr-xr-x | challenge-137/feng-chang/raku/ch-1.raku | 7 | ||||
| -rwxr-xr-x | challenge-137/feng-chang/raku/ch-2.raku | 21 |
2 files changed, 28 insertions, 0 deletions
diff --git a/challenge-137/feng-chang/raku/ch-1.raku b/challenge-137/feng-chang/raku/ch-1.raku new file mode 100755 index 0000000000..b0de7b2725 --- /dev/null +++ b/challenge-137/feng-chang/raku/ch-1.raku @@ -0,0 +1,7 @@ +#!/bin/env raku + +put (1900..2100) + .grep({ Date("$_-12-31").week[1] == 53 }) + .rotor(5, :partial) + .map({ $_.join(', ') }) + .join(",\n"); diff --git a/challenge-137/feng-chang/raku/ch-2.raku b/challenge-137/feng-chang/raku/ch-2.raku new file mode 100755 index 0000000000..7239d2cdb2 --- /dev/null +++ b/challenge-137/feng-chang/raku/ch-2.raku @@ -0,0 +1,21 @@ +#!/bin/env raku + +sub is-palindrome(UInt:D $n --> Bool:D) { $n.flip == $n } + +sub is-lynchel(UInt:D $n --> Bool:D) { + my UInt $m = $n; + my UInt $cnt; + + repeat { + return False if is-palindrome($m); + + $m += $m.flip; + ++$cnt; + } while $cnt < 500; + + ! is-palindrome($m) +} + +sub MAIN(UInt:D $n) { + put +is-lynchel($n); +} |
