Hamming Numbers

The Hamming numbers are all integers of the form 2i×3j×5k, for i, j, k ≥ 0, i.e., 1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 16, ...

Note the use of unbounded buffers in the following program. If a buffer is empty it will only input and store a value. If it is non-empty it will either input and store a value or output the oldest value in its keeping.




The Hamming numbers go on forever but that is not going to happen here so a 'limit' is set to halt the program, which does leave a few hanging Processes remaining.