Humble numbers: Difference between revisions

Line 3,072:
end;
 
def humbles:
range(1;infinite) | select(humble);
def task($digits; $count):
{len: 0, i:0, count: 0}
last(
| until( label.len > $outdigits;
| foreach humbles.i as $i+= ({};1
| if ($.i | tostring | lengthhumble) as $len
|then if $.len >= $digits(.i then| tostring | breaklength) $out
| elseif .humble[$len] +<= 1$digits
then .humble[.len] += 1
end
| if .count < $count then .count += 1 | .humbles += [$.i] else . end; . ) )
else .
| "First \($count):", .humbles,
end
"Distribution of the number of decimal digits up to \($digits) digits:",
else .
(.humble | range(1;length) as $i | " \($i): \(.[$i])");
end)
 
| "First \($count):", .humbles,
task(6;50)
"Distribution of the number of decimal digits up to \($digits) digits:",
</lang>
(.humble | range(1;length) as $i | " \($i): \(.[$i])") ;</lang>
{{out}}
<pre>First 50:
First 50:
[1,2,3,4,5,6,7,8,9,10,12,14,15,16,18,20,21,24,25,27,28,30,32,35,36,40,42,45,48,49,50,54,56,60,63,64,70,72,75,80,81,84,90,96,98,100,105,108,112,120]
Distribution of the number of decimal digits up to 6 digits:
2,484

edits