Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 16 lines (12 sloc) 0.293 kb
12732f2 @colomon First stab at timing harness, two example sequences.
authored
1 sub collatz-length(Int $n) {
2 given $n {
cf0a7e5 @colomon Add scripts, rename scripts, fix glitches in scripts.
authored
3 when 1 { 1 }
4 when * %% 2 { 1 + collatz-length($_ div 2) }
5 when * !%% 2 { 1 + collatz-length(3 * $_ + 1) }
12732f2 @colomon First stab at timing harness, two example sequences.
authored
6 }
7 }
8
9 sub MAIN(*@numbers) {
10 for @numbers -> $n {
11 say "$n: " ~ collatz-length($n.Int);
12 }
13 }
14
15
Something went wrong with that request. Please try again.