Fix compiler warnings on Linux.
Fix integer overflow issue with Go's problem 45.
Fix integer overflow issue with Go's problem 206.
Fix formatting.
Fix integer overflow issue on 32-bit Linux.

Replace xrange with while loop to allow for arbitrarily-large numbers.