attempted brute force for problem 29, distinct powers