aboutsummaryrefslogtreecommitdiff
path: root/challenge-007/uzluisf/perl6/ModuleCH01.pm6
blob: 6b8459d034e29005a0e42bde1b9628ccb8b26ed9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
unit module ModuleCH01;

=begin comment
Challenge 007#1

Print all the niven numbers from 0 to 50 inclusive, each on their own line. A
niven number is a non-negative number that is divisible by the sum of its
digits.
=end comment

multi is-niven( 0 --> False) is export { }
multi is-niven( Int:D $num where * > 0 ) is export {
    $num %% $num.comb.sum;
}