Talk:Rare numbers: Difference between revisions
Content added Content deleted
(Added F# tweaks section.) |
|||
Line 220: | Line 220: | ||
<br>numbers that every ''rare'' number must have (except for the first ''rare'' number ('''65'''), which is found the ''hard'' |
<br>numbers that every ''rare'' number must have (except for the first ''rare'' number ('''65'''), which is found the ''hard'' |
||
<br>(slow) way. |
<br>(slow) way. |
||
== F# tweaks == |
|||
Kudos to Nigel Galloway for the F# version. I don't know the language well, but was able to cut a few corners to improve performance slightly and add some stats: |
|||
{{out|Output at [https://tio.run/##pVXfb9s2EH73X3EwEIdsJEVSgjZ2LAHd1g0DXC@YC/RBMApWohmiEqWK1BSv7d/eHSnZsYu9lS/ikce777tf2mk/r1v@/XvdcAWbvTa8mpzsgz//OhN/k0yoWhuZ68nk@notBS/hD1aWdc/28LoTnTYQ3ZrHwIM4jO6A/Mpaw7VkCpq2Lrrc0EnJDeQPoESy4Z@DXV0Wv7D8E9l1ChQIP812dQvqEqSVixqsKJworLiXvCzwfrEQl1uKZiDLtlsLB36XqgBEA3@zloPqqo@81dBL8wgMCimk0QGcg17AhjdIDTUhujsAnwdA3vWcfeKFuw8gjlUxQG/XwJIJ4LKS/PdhAyIRSVP3CohU5uUtecvQ0OZza8iurJkhguKC@PiINZ4aHkThCgjzI@phRLKBWhauguDlantviX@wvDPm3wQB8WMaBNH2EIPMn6Pi3QrJH9Ekow3W@NHq3oVOjRZiayFCCyxN02crhByBKOqTU1QK1SndwvV1Np@jtXD17GlIXsUa6RInQY2JE9ZdxZ7A2ghXvkKPFR7NUZxb8ehYvDjzJq23K6KuBD25kNT78eioK8706JYe0WHyE7kDNpvNoiQE88ht8SjgpeZggbMGqxohIOcsO0Qpi@5vbFysBZ2cOrQRo3S5XCrn4ufXEAHtaXqSvTJRX1PXE7I0vB06wk/Pwh2TFxSxDnq6q1xbpOFqNrOVaCttuEJVwtM0fxjlvFY5M4OrZ43Rw6EPrUyUJygQdemJS@qnGHy7vUKBYjq9cIUtR3@E6R75qUhZMwKxOaMT1zC6hwQ2pm56ZnLsC4MjYc17MrRT1Rn2seSQ151Ca6gauvOmxV7aYI5Mv3jHn8z7VuI1JTttPI29mGBZQs@hVuUeeqYMmBo05zbZ@EW@BZiuKbkHTdlp0HWF54YZDQyvMOcVM0Yq4WIyel/64@YqcsemD5xfMv0SevE3@BJ70XyhQtzdeK@@QaWn3vjCG4F5ug/elKzRvHgry1IOUDTGIlu@UabdP9RILN0O5Bmmj7XiHxgmiiO9UzBVOLLG5WbZ2s0yK/LBtoVcITvDi6l7aouYuVbHRo9utzgqj7Xargmj8DV1pW/DSEZH0wsG00Ok6VH/COMivtEXrwrkiacXcTGF6RT@nyAw9zy0aWm56VokZpvKcIHA@ZPEoV8X@Kv5Dw Tio.run (linked)]}} |
|||
<pre>nth Rare Number elapsed completed |
|||
1 65 139 ms |
|||
173 ms 2 |
|||
181 ms 3 |
|||
182 ms 4 |
|||
200 ms 5 |
|||
2 621,770 210 ms |
|||
211 ms 6 |
|||
216 ms 7 |
|||
383 ms 8 |
|||
3 281,089,082 405 ms |
|||
449 ms 9 |
|||
4 2,022,652,202 988 ms |
|||
5 2,042,832,002 1690 ms |
|||
3858 ms 10 |
|||
5424 ms 11 |
|||
6 872,546,974,178 33467 ms |
|||
7 872,568,754,178 34525 ms |
|||
</pre>Of course, it can't get too far in the 60 second timeout window. Sometimes it doesn't get past the 5th number, due to poor luck at Tio.run. |
|||
{{out|Output on a i7 core (Visual Studio Console App)}} |
|||
<pre>nth Rare Number elapsed completed |
|||
1 65 22 ms |
|||
24 ms 2 |
|||
26 ms 3 |
|||
27 ms 4 |
|||
28 ms 5 |
|||
2 621,770 31 ms |
|||
31 ms 6 |
|||
34 ms 7 |
|||
68 ms 8 |
|||
3 281,089,082 74 ms |
|||
83 ms 9 |
|||
4 2,022,652,202 292 ms |
|||
5 2,042,832,002 429 ms |
|||
964 ms 10 |
|||
1340 ms 11 |
|||
6 872,546,974,178 6562 ms |
|||
7 872,568,754,178 6758 ms |
|||
8 868,591,084,757 10261 ms |
|||
13375 ms 12 |
|||
9 6,979,302,951,885 18419 ms |
|||
21481 ms 13 |
|||
10 20,313,693,904,202 184922 ms |
|||
11 20,313,839,704,202 185490 ms |
|||
12 20,331,657,922,202 196893 ms |
|||
13 20,331,875,722,202 198502 ms |
|||
14 20,333,875,702,202 202160 ms |
|||
15 40,313,893,704,200 386972 ms |
|||
16 40,351,893,720,200 388014 ms |
|||
452668 ms 14</pre>Checking up to 14 digit numbers in under 8 minutes. Given more time, it can get the correct 17th number (first 15 digit number), but has problems after that. Not sure if it's the memory requirements, or perhaps I pared down Nigel's original program too much for valid output after 14 digits.<br/> |
|||
I added this here in the discussion and did not post the revised code on the main codepage out of respect for Nigel's original contribution. All I did was tweak it, and did not add any core improvements.<br/><br/> |
|||
I've been trying to figure out how to put some limits on the permutation of numbers generated, but don't know F# well enough to do it effectively. And when I work in languages I am familiar with, the performance is decades of magnitude worse.--[[User:Enter your username|Enter your username]] ([[User talk:Enter your username|talk]]) 18:37, 22 September 2019 (UTC) |