You are on page 1of 2

2. Compute 2101 ∗ 1130 by applying the divide-and-conquer algorithm outlined in the text.

Ans:

Below is the general formula.

c = a ∗ b = c2102 + c1101 + c0, where

c2 = a1 ∗ b1 is the product of their first digits,

c0 = a0 ∗ b0 is the product of their second digits,

c1 = (a1 + a0) ∗ (b1 + b0) − (c2 + c0) is the product of the sum of the a’s digits and the sum of

the b’s digits minus the sum of c2 and c0. Let’s break them and calculate,

2101 * 1130

C2 = 21 * 11

C0 = 01 * 30

C1 = (21 + 01) * (11 + 30) – (c2-c0) = 22 * 41 – (21 * 11) – (01 * 30)

Now let’s calculate 21 * 11

In this consider,

C2 = 2 * 1 = 2

C0 = 1 * 1 = 1

C1 = (2 + 1) * (1 + 1) – ( 2 + 1) = 3 * 2 – 3 = 6 – 3 = 3

So, 21 * 11 = 2 *10 power 2 + 3 * 10 power 1 + 1 = 2 *100 + 3 * 10 + 1

= 200 + 30 + 1 = 231

Now, let’s calculate 01 * 30

C2 = 0 * 3 = 0 C0 = 1 * 0 = 0

C1 = (0 + 1) * (3 + 0) – (0 + 0)

=1*3–0

=3–0=3
01 * 30 = 0 * 10 power 2 + 3 * 10 power 1 + 0

=0 * 100 + 3 * 10 + 0

=30

22 * 41:

C2 = 2 * 4 = 8 C0 = 2 * 1 = 2

C1 = (2 +2) * (4+1) – (8 +2) = 4 *5 -10 =20 – 10 = 10

So, 22 *41 = 8 * 10 power 2 + 10* 10 power 1 + 2 = 8 * 100 + 10 * 10 +2

= 800 +100 +2

= 902

So, 2101 * 1130 = 231 * 10 power 4 + (902 – 231 -30) * 10 power 2 + 30

= 231 * 10000 + (641) * 100 + 30

= 2310000 + 64100 + 30

= 2374130

You might also like