Product of divisors: Difference between revisions

→‎{{header|jq}}: streaming approach
(→‎{{header|jq}}: streaming approach)
Line 747:
 
Since a `divisors` function is more likely to be generally useful than a "product of divisors"
function, this entry implements the latter in terms of the former, without any appreciable cost because a streaming approach is used.
<lang jq># divisors as an unsorted stream
def divisors:
Line 777:
{{out}}
<pre>
n product of divisors
n product of divisors
1 1
2 2
Line 830 ⟶ 829:
50 125000
</pre>
'''Example requiringillustrating the use of gojq'''
<lang jq>1234567890 | [., product_of_divisors]
</lang>
2,481

edits