Problems
10091 - Ugly Number
SUBMIT PROBLEM

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.

 

Write a program to check whether a given number is an ugly number. If the number is ugly then print “Yes” otherwise print “No”.

 

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<1012).

 

The Output

For each test case, print a single line “Case X: Yes” if N is an ugly number otherwise print “Case X: No”, here X is the case number start from 1 to T.

 

Sample Input

2

15

14

 

Sample Output

Case 1: Yes

Case 2: No

 

 

 

[School Level]

ISCPC 2017 Preliminary

Problem Setter: Shahin ShamS