
Ugly Numbers
Ugly numbers are numbers whose only prime factors are 2, 3 or 5. The sequence 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, ... shows the first 11 ugly numbers. By convention, 1 is included. The numbers 7, 11, 13 are not ugly because they are prime. The number 14 is not ugly because in its prime factor the 7 will come. Write a program to find and print the N’th ugly number.
Input: N, int.
Output: N'th Ugly Number, int.
Example:
ugly_number(4) == 4 ugly_number(6) == 6 ugly_number(11) == 15
How it’s used: Demonstrate that straight way can be very slow
Precondition: Given int is below or equal of 1500
The mission was taken from ICPC challenge