Algorithm of Karatsuba
The algorithm of Karatsuba (1960) is a method making it possible to quickly multiply two numbers with a complexity out of O (). Note: is approximately equal to 1,58.
Statement
To multiply two numbers of N figures, the usual method requires to multiply each figure of the multiplier by each figure of the multiplicand. That thus requires produced N 2 of two digits. It is said that the computing time is out of O ( N 2).In 1960, Karatsuba, noticing that the calculation of ( has × 10 K + B ) ( C × 10 K + D ) which, in developed form ac × 102 K + ( AD + bc ) × 10 K + data base , seems to require the four products ac , AD , bc and data base , can in fact being only carried out with the three products ac , data base and ( has - B ) ( C - D ) by gathering calculations in the following form:
- 2 × 3 = 6
- 6 × 4 = 24
- (2 - 6) × (3 - 4) = 4
- 6 × 4 = 24
Example
Thus, 12378456 × 25874215 will be calculated as follows:- 1237 × 2587
- 8456 × 4215
- (1237 - 8456) × (2587 - 4215) = 7219 × 1628
- 8456 × 4215
The product 1237 × 2587 itself will be calculated as follows:
- 12 × 25
- 37 × 87
- (12 - 37) × (25 - 87) = 25 × 62
- 37 × 87
The product 12 × 25 will be calculated by means of:
- 1 × 2 = 2
- 2 × 5 = 10
- (1 - 2) × (2 - 5) = 1 × 3 = 3
- 2 × 5 = 10
to obtain 12 × 25 = 2 × 100 + (2 + 10 - 3) × 10 + 10 = 300. One will obtain in the same way:
- 12 × 25 = 300
- 37 × 87 = 3219
- 25 × 62 = 1550
- 37 × 87 = 3219
- 1237 × 2587 = 3200119
- 8456 × 4215 = 35642040
- 7219 × 1628 = 11752532
- 8456 × 4215 = 35642040
- = 320011900000000 + 270896270000 + 35642040
- = 320282831912040
Complete calculation asks for only 27 products of two digits instead of 64 by the usual method. Of course, this method, tiresome with the hand, reveals all its power for a machine having to carry out the product of great numbers. One then obtains an algorithm known as of fast multiplication of two numbers of N figures in elementary operations (such as produces or summons of two digits) instead of N 2. For N = 1000, is about 50.000 whereas N 2 = 1.000.000.
Toom and Cook improved this method by cutting out the numbers in R blocks (instead of 2). The computing time out of O ( N 2) by the usual method passes then out of O ( N 1+ε) where ε is an arbitrary positive reality.
Refer
- A. Karatsuba and Yu Ofman, Multiplication off Many-DIGITAL Numbers by Automatic Computers. Doklady Akad. Nauk SSSR vol. 145 (1962), pp. 293– 294. Translation in Physics-Doklady 7 (1963), pp. 595– 596.
- Karacuba A.A. Berechnungen und die Kompliziertheit von Beziehungen (German) // Elektron. Inform. - verarb. Kybernetik, 11,603-606 (1975).
- Karatsuba A.A. The complexity off computations // Proc. Steklov Inst. Maths., 211,169-183 (1995); translation from Trudy Chechmate. Inst. Steklova, 211,186-202 (1995).
- Knuth D.E. The art off computer programming. v.2 . Addison-Wesley Publ.Co., 724 pp., Reading (1969).
- Algorithm of Karatsuba for the Fast multiplication
- Karatsuba Multiplication one Fast Algorithms and the FAIRY
See too
- Technical of multiplication
- Algorithm Toom-Cook
- Anatolii Alexevich Karatsuba
| Random links: | 241 (number) | Schwaderloch | Colopus kochii | Vlasina Rid | Drive out Masterson | Banlieue_noire_d'amitié,_Michigan |