This page is the answer to the task Hamming numbers in the Rosetta Code.
Description (from Rosetta Code)
| Hamming numbers are numbers of the form
H = 2i × 3j × 5k
i, j, k ≥ 0
Hamming numbers are also known as ugly numbers and also 5-smooth numbers (numbers whose prime divisors are less or equal to 5).
Generate the sequence of Hamming numbers, in increasing order. In particular:
- Show the first twenty Hamming numbers.
- Show the 1691st Hamming number (the last one below 231).
- Show the one millionth Hamming number (if the language – or a convenient library – supports arbitrary-precision integers).
Case 1. First twenty Hamming numbers
Case 2. 1691st Hamming number
Case 3. One millionth Hamming number