#077 - 1

Run Settings
LanguageRaku
Language Version
Run Command
multi fsum([] , UInt ) { Empty } multi fsum([UInt $first, *@rest], UInt $num where * < $first) { Empty } multi fsum([UInt $first, *@rest], UInt $num where * == $first) { [[ $first, ],] } multi fsum([UInt $first, *@rest], UInt $num where * > $first) { [|fsum(@rest, $num), |fsum(@rest, $num - $first).map: -> @seq { [$first, |@seq] } ] } sub fibonacci-sum($sum) { my @fib = 1, 2, &[+] ... *; my $f = @fib.first: * > $sum; fsum @fib[^$f], $sum } for ^20 { say .sum, " == ", .join(" + ") for fibonacci-sum $_ }
Editor Settings
Theme
Key bindings
Full width
Lines