Reflecting Powers- Open Middle Problem (maybe?)

When working with a student today, she noticed that:

power example.pngand wondered if that pattern works for any other numbers.


So, for any integer a,b when does

power example 2.png


Would changing the constraint on a,b change the problem?  What number types would produce more values for a and b?