Humble numbers: Difference between revisions
→Fast and economical: improve space management
(→Fast and economical: task(16)) |
(→Fast and economical: improve space management) |
||
Line 3,111:
def update:
.[0] as $h
| ([$h * 2, $h * 3, $h * 5, $h * 7] | map(select(tostring|length <= $digits))) as $next
|
else (.[1:] + $next) | sort
end;
def trim: if length <= 1 then . elif .[0]==.[1] then .[1:]|trim else . end;
{
|
| queue |= (update|trim) )
def distribution(stream):
Line 3,149:
15: 7545
16: 9081</pre>
The queue in this case grows to a maximum length of about 18K.
=={{header|Julia}}==
|