Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
9
Task/Executable-library/Raku/executable-library-1.raku
Normal file
9
Task/Executable-library/Raku/executable-library-1.raku
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
module Hailstone {
|
||||
our sub hailstone($n) is export {
|
||||
$n, { $_ %% 2 ?? $_ div 2 !! $_ * 3 + 1 } ... 1
|
||||
}
|
||||
}
|
||||
|
||||
sub MAIN {
|
||||
say "hailstone(27) = {.[^4]} [...] {.[*-4 .. *-1]}" given Hailstone::hailstone 27;
|
||||
}
|
||||
1
Task/Executable-library/Raku/executable-library-2.raku
Normal file
1
Task/Executable-library/Raku/executable-library-2.raku
Normal file
|
|
@ -0,0 +1 @@
|
|||
$ raku Hailstone.rakumod
|
||||
4
Task/Executable-library/Raku/executable-library-3.raku
Normal file
4
Task/Executable-library/Raku/executable-library-3.raku
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
use Hailstone;
|
||||
my %score;
|
||||
(1 .. 100_000).race.map: { %score{hailstone($_).elems}++ };
|
||||
say "Most common length is {.key}, occurring {.value} times." given max :by(*.value), %score;
|
||||
Loading…
Add table
Add a link
Reference in a new issue