Prime Factors Only

In this exercise, an “ugly” number is not a bad number — it is a number with a special set of prime factors. Given a number n, return True if it is positive and all of its prime factors are only 2, 3, and 5. The number 1 also counts as valid.

Примеры

Ввод
6
Вывод
True
Ввод
1
Вывод
True
Ввод
14
Вывод
False

Нужно реализовать

def is_ugly(n: int) -> bool:

Теги

math
PostgreSQLv16

Hawn jidher ir-riżultat tat-tħaddim tal-kodiċi

Visible tests
1
Input
6
ExpectedTrue
2
Input
1
ExpectedTrue
3
Input
14
ExpectedFalse
4
Input
8
ExpectedTrue
5
Input
0
ExpectedFalse
6
Input
7
ExpectedFalse
Focus radio
Paused · SomaFM · Fluid