微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

biginteger – 大数分部

除了学校方法之外,还有更快的方法来划分大整数(1000位或更多)吗?

解决方法

维基百科列出 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.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐