Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
13
Task/Fusc-sequence/Raku/fusc-sequence-1.raku
Normal file
13
Task/Fusc-sequence/Raku/fusc-sequence-1.raku
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
my @Fusc = 0, 1, 1, { |(@Fusc[$_ - 1] + @Fusc[$_], @Fusc[$_]) given ++$+1 } ... *;
|
||||
|
||||
sub comma { $^i.flip.comb(3).join(',').flip }
|
||||
|
||||
put "First 61 terms of the Fusc sequence:\n{@Fusc[^61]}" ~
|
||||
"\n\nIndex and value for first term longer than any previous:";
|
||||
|
||||
for flat 'Index', 'Value', 0, 0, (1..4).map({
|
||||
my $l = 10**$_;
|
||||
@Fusc.first(* > $l, :kv).map: &comma
|
||||
}) -> $i, $v {
|
||||
printf "%15s : %s\n", $i, $v
|
||||
}
|
||||
5
Task/Fusc-sequence/Raku/fusc-sequence-2.raku
Normal file
5
Task/Fusc-sequence/Raku/fusc-sequence-2.raku
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
multi fusc( 0 ) { 0 }
|
||||
multi fusc( 1 ) { 1 }
|
||||
multi fusc( $n where $n %% 2 ) { fusc $n div 2 }
|
||||
multi fusc( $n ) { [+] map *.&fusc, ( $n - 1 ) div 2, ( $n + 1 ) div 2 }
|
||||
put map *.&fusc, 0..60;
|
||||
Loading…
Add table
Add a link
Reference in a new issue