aboutsummaryrefslogtreecommitdiff
path: root/challenge-013/feng-chang/raku/ch-2.p6
blob: 262dfce17778f53114bc7e2d5ed8e06171626bdf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/env perl6

multi F(0) { 1 }
multi F(Int $n where * > 0) { $n - M(F($n - 1)) }

multi M(0) { 0 }
multi M(Int $n where * > 0) { $n - F(M($n - 1)) }

sub MAIN(Int $n where * >= 0) {
    (^$n)».&F.say;
    (^$n)».&M.say;
}