fixing power for nonnegative integers

#8650