Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- inline bool isPow(int n)
- {
- for (int base = 2; base * base <= n; base++)
- {
- int b1 = 0, p = 1;
- for (int b = 1; b <= n; b++)
- {
- while (b1 <= b)
- {
- p *= base;
- b1++;
- }
- if (n == p)
- return true;
- }
- }
- return false;
- }
- inline bool isPowOfBase(int power,int base)
- {
- if (power == 1)
- return true;
- if (base == 1)
- return power == 1;
- if (!base)
- return !power;
- int temp = base;
- while(temp < power) temp *= base;
- return temp == power;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement