A natural number greater than zero is a *Hamming number*
if its divisors are only 2, 3 or 5.
The twelve first Hamming numbers are 1, 2, 3, 4, 5, 8, 9, 10, 12, 15 and 16.
However, neither 42 nor 97 are not Hamming numbers:
42 is divisible by 7, and 97 is a prime number greater than 5.

Your task is to write a program that prints the *n* first Hamming numbers for different values of *n*.

Your program must include and use the function

that indicates if a natural number |x| greater than zero is a Hamming number or is not.

**Input**

The input is a sequence of natural numbers.

**Output**

For each natural number *n* of the input print, in a line and separated by commas,
the first *n* Hamming numbers in increasing order.

**Observation**

There are astute ways to generate the *n* first Hamming numbers sorted.
We do not ask you to discover them:
simply, implement a reasonable algorithm.

Public test cases

**Input**

12 2 6 0 1

**Output**

1,2,3,4,5,6,8,9,10,12,15,16 1,2 1,2,3,4,5,6 1

Information

- Author
- Professorat de P1
- Language
- English
- Translator
- Carlos Molina
- Original language
- Catalan
- Other languages
- Catalan
- Official solutions
- C++
- User solutions
- C++