超级素数

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
def super_prime(x: int) -> bool:
    if x < 10:
        return x in (2, 3, 5, 7)
    factor = 1
    while factor * factor <= x:
        factor += 1
        if x % factor == 0:
            return False
    return super_prime(x // 10)

n = int(input())
print(super_prime(n) and 'YES' or 'NO')