Hamming numbers: Difference between revisions

m
→‎{{header|Elm}}: correct "off by one" error...
(→‎{{header|Elm}}: clean up code...)
m (→‎{{header|Elm}}: correct "off by one" error...)
Line 3,906:
in timemillis()
|> andThen (\ strt ->
let rsltstr = hammingsLog() |> nthCIS (lmt - 1)
|> showTrival in
timemillis()
Line 3,931:
The 1691st Hamming number is 2125764000.
The 1000000th Hamming number is:
519298692278785094152510283943756293079298533583627301759029258223616000000000000000519312780448388736089589843750000000000000000000000000000000000000000000000000000000 in 756767 milliseconds.</pre>
 
Do note that, due to the logarithmic response of the Min Heap Priority Queue, the execution time is logarithmic with number of elements evaluation and not linear as it would otherwise be, so if it takes 0.7 seconds to find the millionth Hamming number, it takes something about 10 seconds to find the ten millionth value instead of about 7 seconds. Considering that the generated "native" code is just JavaScript, it is reasonably fast and somewhat competitive with easier implementations in other languages such as F#.
474

edits