Given an integer, write a function to determine if it is a power of three.
Follow up:
Could you do it without using any loop / recursion?
判斷整數是不是3的冪數
1 bool isPowerOfThree(int n) { 2 // 1162261467 is 3^19, 3^20 is bigger than int 3 return ( n>0 && 1162261467%n==0); 4 }