Self-describing numbers: Difference between revisions
Content added Content deleted
(→{{header|Go}}: Added an optimized version,) |
|||
Line 598: | Line 598: | ||
end |
end |
||
t = Time.monotonic |
|||
3_300_000.times { |n| puts n if self_describing?(n) }</lang> |
|||
600_000_000.times { |n| (puts "#{n} in #{(Time.monotonic - t).total_seconds} secs"; |
|||
outputs |
|||
t = Time.monotonic) if self_describing?(n) }</lang> |
|||
⚫ | |||
{{out}} |
|||
2020 |
|||
<pre>System: I5-2410m, 2.9 GHz, Linux Kernel 5.5.17, Crystal 0.34 |
|||
21200 |
|||
Compil: $ crystal build selfdescribing.cr --release |
|||
3211000</pre> |
|||
Run as: $ time ./selfdescribing |
|||
1210 in 0.000409776 secs |
|||
2020 in 0.000297622 secs |
|||
21200 in 0.00572197 secs |
|||
3211000 in 0.838187027 secs |
|||
42101000 in 10.495628302 secs |
|||
521001000 in 134.207962214 secs |
|||
./selfdescribing 178.38s user 8.74s system 111% cpu 2:47.70 total |
|||
⚫ | |||
=={{header|D}}== |
=={{header|D}}== |