x and y using the logarithm: a = floor(log(bound) / log(x)) and b = floor(log(bound) / log(y)).powerfulIntegers to store the unique powerful integers.0 to a and the inner loop runs from 0 to b.x^i + y^j and check if it is less than or equal to bound.powerfulIntegers.x or y is 1 by breaking out of the loop early since further iterations will not change the result.