#C4387. Determine if a Number is a Power of Three
Determine if a Number is a Power of Three
Determine if a Number is a Power of Three
Given an integer n, determine whether it is a power of three. In mathematical terms, n is a power of three if there exists a non-negative integer k such that:
\( n = 3^{k} \)
Please note that for the purpose of this problem, only positive integers can be powers of three. For example, 0 and any negative numbers are not considered valid powers of three.
inputFormat
The input is read from stdin and consists of a single line containing an integer n.
outputFormat
Print True
(without quotes) if n is a power of three; otherwise, print False
(without quotes). The output is written to stdout.
27
True
</p>