add special cases for powers 3 and 4, in addition to 2