Zumkeller numbers: Difference between revisions
Content deleted Content added
→{{header|jq}}: the tasks |
→{{header|jq}}: rm unused defs |
||
Line 2,330: | Line 2,330: | ||
end |
end |
||
| sort) ; |
| sort) ; |
||
def sum(s): reduce s as $x (0; . + $x); |
|||
# sum of a slice, without any allocation |
|||
def sum($i; $j): . as $in | reduce range($i; $j) as $ix (0; . + $in[$ix]); |
|||
# If the input is a sorted array of distinct non-negative integers, |
# If the input is a sorted array of distinct non-negative integers, |