解决方法
维基百科列出
multiple division algorithms.见
Computational complexity of mathematical operations,其中
Schoolbook long division为O(n ^ 2),Newton’s method为M(n),其中M是所用乘法算法的复杂度,可以与O一样好(n log n 2 ^(
log*
n)渐渐地.
从one of the multiplication algorithms的讨论中注意到,渐近的最佳算法不一定是“小”输入的最快算法:
In practice the Schönhage–Strassen algorithm starts to outperform older methods such as Karatsuba and Toom–Cook multiplication for numbers beyond 2^(2^15) to 2^(2^17) (10,000 to 40,000 decimal digits). The GNU Multi-Precision Library uses it for values of at least 1728 to 7808 64-bit words (111,000 to 500,000 decimal digits),depending on architecture. There is a Java implementation of Schönhage–Strassen which uses it above 74,000 decimal digits.