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

An integer n is a power of four, if there exists an integer x such that n == 4x.

&nbsp;
Example 1:
Input: n = 16
Output: true
Example 2:
Input: n = 5
Output: false
Example 3:
Input: n = 1
Output: true

&nbsp;
Constraints:


	-231 &lt;= n &lt;= 231 - 1


&nbsp;
Follow up: Could you solve it without loops/recursion?
import math 
class Solution:
    def isPowerOfFour(self, n: int) -> bool:

        if n <= 0:
            return False
        return math.log(n, 4).is_integer()
class Solution {
    public boolean isPowerOfFour(int n) {
        return (Math.log10(n)/Math.log10(4))%1==0;
    }
}
class Solution {
public:
    bool isPowerOfFour(int n) {
        if(n==1)
            return true;
        long long p=1;
        for(int i=1;i<n;i++)
        {
            p=p*4;
            if(p==n)
                return true;
            if(p>n)
                return false;
        }
        return false;
    }
};
var isPowerOfFour = function(n) {
    if(n==1){
        return true
    }
    let a=1;
    for(let i=2;i<=30;i++){
        a=a*4
        if(a===n){
            return true
        }
    }
    return false
};
Power of Four