<jupyter_start><jupyter_text>说明：    编写程序以检查给定的数字是否是丑陋的数字。    丑数是正数，其质数因子仅包括2、3、5。Example 1:    Input: 6    Output: true    Explanation: 6 = 2 × 3Example 2:    Input: 8    Output: true    Explanation: 8 = 2 × 2 × 2Example 3:    Input: 14    Output: false     Explanation: 14 is not ugly since it includes another prime factor 7.注意：    1、1通常被视为丑数。    2、输入在32位有符号整数范围内：[−2^31，2^31 − 1]。<jupyter_code>from math import sqrt

class Solution:
    def isUgly(self, num: int) -> bool:
        if num == 1: return True
        max_val = int(sqrt(num)) + 1
        ugly_primes = [2, 3, 5]
        for i in range(2, max_val + 1):
            if num % i == 0:
                if self.is_prime(i) and (i not in ugly_primes or num // i not in ugly_primes):
                    print(i)
                    return False
        return True
    
    def is_prime(self, n):
        # 判断n是不是素数
        max_val = int(sqrt(n)) + 1
        for i in range(2, max_val):
            if n % i == 0:
                return False
        return True
class Solution:
    def isUgly(self, num: int) -> bool:
        if num == 0: 
            return False
        while num % 5 == 0: 
            num /= 5
        while num % 3 == 0: 
            num /= 3
        while num % 2 == 0: 
            num /= 2
        return num == 1
num_ = 8
solution = Solution()
solution.isUgly(num_)
solution.is_prime(11)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10548823948681398, 'fraction_numerical': 0.040627227369921595, 'mean_word_length': 1.7315175097276265, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '477664', 'license': 'Apache-2.0', 'n_tokens_mistral': 571, 'n_tokens_neox': 527, 'n_words': 155, 'path': 'Math/0826/263. Ugly Number.ipynb', 'repo_name': 'YuHe0108/Leetcode', 'size': '1403'}