Numbers which are the cube roots of the product of their proper divisors: Difference between revisions
Numbers which are the cube roots of the product of their proper divisors (view source)
Revision as of 04:38, 2 November 2022
, 1 year ago→{{header|jq}}: def harness:
(→{{header|jq}}: def numbers_being_cube_roots_of_their_proper_divisors:) |
(→{{header|jq}}: def harness:) |
||
Line 481:
'''Generic utilities'''
<syntaxhighlight lang=jq>
# Notice that `prod(empty)` evaluates to 1.
def prod(s): reduce s as $x (1; . * $x);
Line 504 ⟶ 505:
# print first 50 and then the 500th, 5000th, and $limit-th
def
"First 50 numbers which are the cube roots of the products of their proper divisors:",▼
| foreach generator as $n (
▲ ( label $out
{ numbers50: [],
| foreach numbers_being_cube_roots_of_their_proper_divisors as $n (▼
.emit =
|
else if .count <= 50
| if .count == 50
elif .count
then .emit
end
| .emit // empty
</syntaxhighlight>
</syntaxhighlight>
{{out}}
|