开发者

How can I convert a very large integer from one base/radix to another using FFT?

开发者 https://www.devze.com 2023-03-15 12:25 出处:网络
Are there known algorithms which will take a big integer with n digits encoded in one base/radix and convert it to another arbitrary base? (Let\'s say from base 7 to base 19.) n can be really big, lik

Are there known algorithms which will take a big integer with n digits encoded in one base/radix and convert it to another arbitrary base? (Let's say from base 7 to base 19.) n can be really big, like more than 100 000 digits, so I am looking for something better than开发者_运维技巧 O(n2) run time.

I have seen some algorithms that can multiply two huge integers using the Fast Fourier Transform (FFT), with the theoretical complexity of O(n log n), where n is the number of digits, so I wonder if something similar exists for bases/radix conversion?


I'm not well versed on the topic myself, but here's a page that hints at how to do radix conversion a bit faster than the naive remainder-and-divide algorithm:

  • GNU MP - Binary to Radix

The page hints that you need a fast divide-and-conquer division algorithm, which in turn needs a fast multiplication algorithm (Karatsuba, Toom-Cook, FFT, etc.).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号