# LeetCode 263 Ugly Number

Write a program to check whether a given number is an ugly number.

Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 6, 8 are ugly while 14 is not ugly since it includes another prime factor 7.

Note that 1 is typically treated as an ugly number.

public class Solution {
public boolean isUgly(int num) {
if(num == 0) {
return false;
}
while(num % 2 == 0) {
num /= 2;
}
while(num % 3 == 0) {
num /= 3;
}
while(num % 5 == 0) {
num /= 5;
}
return num == 1;
}
}

#### leetcode 263: Ugly Number

2015-08-19 20:17:44

#### [Leetcode-263] Ugly Number（丑陋数）

2015-09-05 10:57:39

#### 剑指offer 面试题34：寻找丑数(Leetcode 263.ugly number)解题报告

2016-05-07 10:13:47

#### [leetcode] 264. Ugly Number II 解题报告

2015-12-13 15:54:50

#### [Leetcode 264] Ugly Number II

2015-09-02 00:23:05

#### leetcode笔记：Ugly Number II

2016-01-10 18:42:23

#### leetcode -- Super Ugly Number -- 跟ugly number系列一起复习

2015-12-22 12:01:11

#### LeetCode 313. Super Ugly Number

2016-03-29 23:24:34

#### [leetcode-264]Ugly Number II(java)

2015-08-24 11:12:50

#### 【LEETCODE】313-Super Ugly Number [Python]

2016-01-26 16:32:03