Description

An ugly number is a positive integer whose prime factors are limited to 2, 3, and 5. Given an integer n, return true if n is an ugly number. Note that 1 is typically treated as an ugly number.

Examples

Input:n = 6
Output:true
Explanation:

6 = 2 × 3.

Input:n = 1
Output:true
Explanation:

1 is considered an ugly number (3^0 = 1).

Input:n = 14
Output:false
Explanation:

14 = 2 * 7. Since 7 is not a factor of 2, 3, or 5, 14 is not an ugly number.

Constraints

  • -2³¹ ≤ n ≤ 2³¹ - 1

Ready to solve this problem?

Practice solo or challenge other developers in a real-time coding battle!