Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
10 lines (8 sloc) 216 Bytes
sub collatz-length(Int $start) {
+($start, { when * %% 2 { $_ / 2 }; when * !%% 2 { 3 * $_ + 1 }; } ... 1);
}
sub MAIN(*@numbers) {
for @numbers -> $n {
say "$n: " ~ collatz-length($n.Int);
}
}
Something went wrong with that request. Please try again.