diff options
| -rw-r--r-- | challenge-030/ozzy/perl6/ch-2.p6 | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/challenge-030/ozzy/perl6/ch-2.p6 b/challenge-030/ozzy/perl6/ch-2.p6 new file mode 100644 index 0000000000..d7ccfc6205 --- /dev/null +++ b/challenge-030/ozzy/perl6/ch-2.p6 @@ -0,0 +1,8 @@ +#!/bin/env perl6 + +# Challenge: Write a script to print all possible series of 3 positive numbers, where in each series +# at least one of the number is even and sum of the three numbers is always 12. For example, 3,4,5. +# NOTE: For the purpose of this solution, 0 is considered a positive, even number. + +say "Combinations: ", my @c = (^9).combinations(3).grep: { .sum == 12 && (.first: * %% 2).defined }; +say "Permutations: ", my @p = gather { my @x; for @c -> $l { @x = $l.permutations; .take for @x } }; |
