Hamming numbers |
.
Dijkstra attributes to Hamming the problem of building the infinite ascending sequence of all positive numbers greater than 1 containing no prime factors other than 2, 3 and 5, i.e. numbers of the form 2^i x 3^j x 5^k (i,j,k >= 0). The ideas to compute them are the following:
This algorithm is often used to demonstrate the power of a lazy functional programming language, because this algorithms can be implemented as described above, while an implementation for a strict functional or imperative programming language is highly non-trivial.
= External links =
|
|