> For the complete documentation index, see [llms.txt](https://r24zeng.gitbook.io/leetcode-notebook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://r24zeng.gitbook.io/leetcode-notebook/bu-chong-81100-dao/263.-ugly-number.md).

# 263. Ugly Number

\# Easy

{% hint style="info" %}
Solution is interesting. Conditions should be careful.
{% endhint %}

{% tabs %}
{% tab title="Python" %}

```python
class Solution:
    def isUgly(self, num: int) -> bool:
        while num >= 2 and num%2 == 0:
            num = num//2
        while num >= 3 and num%3 == 0:
            num = num//3
        while num >= 5 and num%5 == 0:
            num = num//5
        
        if num == 1:
            return True
        else:
            return False
```

{% endtab %}
{% endtabs %}
