Checks if this integer is a power of base.
base
bool isPowerOf(int base) { if (base <= 1) return this == base; var n = this; while (n % base == 0) { n ~/= base; } return n == 1; }