Question
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?
Solution
This can be generalized for any 【prime】 number n.
Lets say we have 2 number m & n.
If m is a power of n then for any number p,
1. For all p<=m
2. m%p = 0 if and only if p is also a power