# 326. Power of Three

#### Easy

***

Given an integer `n`, return *`true` if it is a power of three. Otherwise, return `false`*.

An integer `n` is a power of three, if there exists an integer `x` such that `n == 3x`.

&#x20;

**Example 1:**

<pre><code>Input: n = 27
<strong>Output:
</strong> true
</code></pre>

**Example 2:**

<pre><code>Input: n = 0
<strong>Output:
</strong> false
</code></pre>

**Example 3:**

<pre><code>Input: n = 9
<strong>Output:
</strong> true
</code></pre>

&#x20;

**Constraints:**

* `-231 <= n <= 231 - 1`

&#x20;

**Follow up:** Could you solve it without loops/recursion?

```python
class Solution:
    def isPowerOfThree(self, n: int) -> bool:
        return n > 0 and (log10(n)/log10(3)).is_integer()
```
