如果数字是奇数位数,如何应用karatsuba算法? [英] How to apply karatsuba algorithm if a number is odd digits number ?

查看:137
本文介绍了如果数字是奇数位数,如何应用karatsuba算法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我正在学习一种算法 karatsuba 这是禁食的乘法算法。当x = 1234,y = 4658,时,它很好,因为数字是偶数位数河所以我可以很容易地分开x和y的两部分

Recently i am learning a algorithm karatsuba which is the fasted multiplication algorithm..It was fine when x = 1234 , y = 4658 ,because the number is even digits number. So i can easily separate two portion of x and y

x= 1234 , so a = 12 , b = 34
y= 4658 , so c = 46 , d = 58



。但是如果x = 123那我怎么能分开两个部分?


. But if x = 123 then how can i separate two portion ?

推荐答案

a = 1,b = 23

或者我错过了什么?

请参阅 https://en.wikipedia.org/wiki/Karatsuba_algorithm [ ^ ]并按照示例操作。在您的情况下,因子是100,而不是示例中的1000.

问候

Andi
a = 1, b = 23
Or am I missing something?
See https://en.wikipedia.org/wiki/Karatsuba_algorithm[^] and follow the example. In your case, the factor is 100, not 1000 as in the example.
Regards
Andi


这篇关于如果数字是奇数位数,如何应用karatsuba算法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆