Hamming numbers: Difference between revisions

m
(→‎Extremely fast non-sequence version by calculation of top band of Hamming numbers: Rust - add imperative sequence using logarithmic approximations...)
Line 10,819:
Most of the remaining execution time for the above version is due to the many allocations/deallocations used in implementing the functional lazy list sequence; the following code avoids that overhead by memoizing the pst values using linear vectors with the head and tail values marked by tracking indices:
{{trans|Nim}}
<syntaxhighlight lang=rust>extern crate num;
 
<lang rust>
extern crate num;
use num::bigint::BigUint;
 
Line 10,982 ⟶ 10,980:
println!("This last took {} milliseconds.", dur);
}</syntaxhighlight>
}
</lang>
 
{{out}}
474

edits