Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

12 lines (8 sloc) 0.22 kb
sub collatz-length(Int $start) {
+($start, { when * %% 2 { $_ div 2 }; when * !%% 2 { 3 * $_ + 1 }; } ... 1);
}
sub MAIN(*@numbers) {
for @numbers -> $n {
say "$n: " ~ collatz-length($n.Int);
}
}
Jump to Line
Something went wrong with that request. Please try again.