N’th Ugly Number
Time Limit: 1 sec
The Problem
Ugly numbers are positive numbers whose prime factors only include 3, 5, 7. For example, 15, 21 are ugly while 14 is not ugly since it includes another prime factor 2. The sequence
1, 3, 5, 7, 9, 15, 21, 25, 27, 35
shows the first 10 ugly numbers. Note that 1 is typically treated as an ugly number.
Given an integer number N, you need to find the N’th ugly number.
The Input
The first line contains an integer number T, which indicates the number of test cases (0<T<1000). Each test case is given in one line. This line contains a positive integer number N (0<N<1501).
The Output
For each test case, print a single line “Case X: U”, here X is the case number start from 1 to T and U is the N’th ugly number.
Sample Input
3
1
4
6
Sample Output
Case 1: 1
Case 2: 7
Case 3: 15
[College Level]
ISCPC 2017 Preliminary
Problem Setter: Shahin ShamS