perfect powers c# -- naive and 2nd attempt