Humble numbers: Difference between revisions

added Mathematica solution
(Added Algol 68)
(added Mathematica solution)
Line 3,336:
1272 have 8 digits
1767 have 9 digits</pre>
 
=={{header|Mathematica}}==
Create a simple function which efficiently generates humble numbers up to an inputted max number, then call it twice to generate the output. Finds the number of humble numbers with digits up to 100 in 5 minutes.
 
<lang Mathematica>
HumbleGenerator[max_] :=
Sort[Flatten@
ParallelTable[
2^i 3^j 5^k 7^m, {i, 0, Log[2, max]}, {j, 0, Log[3, max/2^i]}, {k,
0, Log[5, max/(2^i 3^j)]}, {m, 0, Log[7, max/(2^i 3^j 5^k)]}]]
{"First 50 Humble Numbers:",
HumbleGenerator[120],
"\nDigits\[Rule]Count",
Rule @@@ Tally[IntegerLength /@ Drop[HumbleGenerator[10^100], -1]] //
Column} // Column
</lang>
 
{{out}}
<pre style="height:64ex;overflow:scroll">
First 50 Humble Numbers:
{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}
 
Digits->Count
1->9
2->36
3->95
4->197
5->356
6->579
7->882
8->1272
9->1767
10->2381
11->3113
12->3984
13->5002
14->6187
15->7545
16->9081
17->10815
18->12759
19->14927
20->17323
21->19960
22->22853
23->26015
24->29458
25->33188
26->37222
27->41568
28->46245
29->51254
30->56618
31->62338
32->68437
33->74917
34->81793
35->89083
36->96786
37->104926
38->113511
39->122546
40->132054
41->142038
42->152515
43->163497
44->174986
45->187004
46->199565
47->212675
48->226346
49->240590
50->255415
51->270843
52->286880
53->303533
54->320821
55->338750
56->357343
57->376599
58->396533
59->417160
60->438492
61->460533
62->483307
63->506820
64->531076
65->556104
66->581902
67->608483
68->635864
69->664053
70->693065
71->722911
72->753593
73->785141
74->817554
75->850847
76->885037
77->920120
78->956120
79->993058
80->1030928
81->1069748
82->1109528
83->1150287
84->1192035
85->1234774
86->1278527
87->1323301
88->1369106
89->1415956
90->1463862
91->1512840
92->1562897
93->1614050
94->1666302
95->1719669
96->1774166
97->1829805
98->1886590
99->1944540
100->2003661
</pre>
 
 
 
=={{header|Nim}}==
Anonymous user