Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/while-3-ning-darajasini-tekshirish

Power of three check

Easy 1000 ms 64 MB 25%
Share

A positive integer $n$ is given. If $n$ is an integer power of $3$ ($n = 3^{k}$, $k \ge 0$), print true, otherwise false.

Checking a power of three by repeated division

Input

One integer $n$.

Output

true or false accordingly.

Note

$1 \le n \le 2 * 10^{9}$

Examples

Input #1
9
Output #1
true
Input #2
27
Output #2
true

Sign in to submit a solution

Signing up is free and takes a minute.