aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2019-05-07 13:11:08 +0100
committerGitHub <noreply@github.com>2019-05-07 13:11:08 +0100
commit4fb79e995fce5e5f529785b22dd512a0e41876cb (patch)
tree14d6789cd8c718b618c834f3ca896799057d63c8
parent4f59a65afbd71db684cb5ae275c8d1d6b1f03b5e (diff)
parent9bfff5cebb513d1ef3d063000eb668e4559fa240 (diff)
downloadperlweeklychallenge-club-4fb79e995fce5e5f529785b22dd512a0e41876cb.tar.gz
perlweeklychallenge-club-4fb79e995fce5e5f529785b22dd512a0e41876cb.tar.bz2
perlweeklychallenge-club-4fb79e995fce5e5f529785b22dd512a0e41876cb.zip
Merge pull request #127 from Scimon/master
Challenge 1. Niven numbers.
-rwxr-xr-xchallenge-007/simon-proctor/perl6/ch-1.p613
1 files changed, 13 insertions, 0 deletions
diff --git a/challenge-007/simon-proctor/perl6/ch-1.p6 b/challenge-007/simon-proctor/perl6/ch-1.p6
new file mode 100755
index 0000000000..f2ff5cf134
--- /dev/null
+++ b/challenge-007/simon-proctor/perl6/ch-1.p6
@@ -0,0 +1,13 @@
+#!/usr/bin/env perl6
+
+use v6;
+
+multi sub is-niven( 0 ) { False }
+
+multi sub is-niven( Int $num where * > 0 ) {
+ $num %% [+] $num.comb;
+}
+
+sub MAIN( UInt() $max=50 ) {
+ .say if is-niven($_) for 0..$max;
+}