Fix 32-bit overflow in 5^17
Ensure correct unsigned arithmetic promotion between 32-bit/64-bit.