Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
8
Task/Hailstone-sequence/Raku/hailstone-sequence.raku
Normal file
8
Task/Hailstone-sequence/Raku/hailstone-sequence.raku
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
sub hailstone($n) { $n, { $_ %% 2 ?? $_ div 2 !! $_ * 3 + 1 } ... 1 }
|
||||
|
||||
my @h = hailstone(27);
|
||||
say "Length of hailstone(27) = {+@h}";
|
||||
say ~@h;
|
||||
|
||||
my $m = max ( (1..99_999).race.map: { +hailstone($_) => $_ } );
|
||||
say "Max length {$m.key} was found for hailstone({$m.value}) for numbers < 100_000";
|
||||
Loading…
Add table
Add a link
Reference in a new issue