Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
150 B
1
Indexable
Never
def fun(n):
    if n == 1:
        return 'YES'
    if n < 1 or n % 3 != 0:
        return 'NO'
    return fun(n // 3)

q = int(input())
print(fun(q))