Karatsuba's algorithm

> a1 := op(1,evalf(Pi,10000)):

> type(a1,integer);

[Maple Math]

How many digits are in the integer a1 ?

> length(a1);

[Maple Math]

How long (in seconds) does it take to square a1 ?

> st := time(): a2 := a1^2: t2 := time()-st;

[Maple Math]

> length(a2);

[Maple Math]

How long does it take to square a2, where a2 has almost double the number of digits (19999 digits) that a1 has.

> st := time(): a4 := a2^2: t4 := time()-st;

[Maple Math]

> length(a4);

[Maple Math]

The ratio of the computation times should be close to 3 if Karatsuba's algorithm is used for integer multiplication.

> almost_3 := t4/t2;

[Maple Math]