/*
* @lc app=leetcode.cn id=263 lang=typescript
*
* [263] 丑数
*/
// @lc code=start
function isUgly(n: number): boolean {}
// @lc code=end
function isUgly(n: number): boolean {
if (n <= 0) return false
for (const num of [2, 3, 5]) {
while (n % num === 0) {
n = n / num
}
}
return n === 1
}
test.each([
{ input: { n: 6 }, output: true },
{ input: { n: 8 }, output: true },
{ input: { n: 14 }, output: false },
{ input: { n: 1 }, output: true },
])(`input: n = $input.n`, ({ input: { n }, output }) => {
expect(isUgly(n)).toBe(output)
})