Fixed consecutive squaring
Improved factorization for numbers less than 2^64-1.