aboutsummaryrefslogtreecommitdiff
path: root/challenge-050/javier-luque/raku/ch-2.p6
blob: 3e23d110cb113e498fe07966c2b132f1624d9883 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Test: perl6 ch-2.p6
use v6.d;

sub MAIN() {
    my $list_size = 50;

    # Create @L
    my @L = ((1 .. 50).roll: $list_size) ;

    # Output the list
    say 'List: ' ~ @L.perl;

    # Find Noble number
    my $noble =
        @L.sort.pairs.grep(
            {.key == $list_size - .value}
        )>>.value;

    # Output it if found
    say "Noble found: " ~ $noble
        if ($noble);
}