Sum and product puzzle: Difference between revisions
Content added Content deleted
(→{{header|Raku}}: `sum` on lists is already defined) |
(→{{header|Raku}}: Reverting previous change - the built-in `sum ` should probably not actually work here, even though it does at least in v2022.12.) |
||
Line 2,331: | Line 2,331: | ||
sub sums ($n) { ($_, $n - $_ for 2 .. $n div 2) } |
sub sums ($n) { ($_, $n - $_ for 2 .. $n div 2) } |
||
sub product ([$x, $y]) { $x * $y } |
sub product ([$x, $y]) { $x * $y } |
||
sub sum ([$x, $y]) { $x + $y } |
|||
my @all-pairs = (|($_ X $_+1 .. 98) for 2..97); |
my @all-pairs = (|($_ X $_+1 .. 98) for 2..97); |