Karatsuba algorithm too much recursion
问题 I am trying to implement the Karatsuba multiplication algorithm in c++ but right now I am just trying to get it to work in python. Here is my code: def mult(x, y, b, m): if max(x, y) < b: return x * y bm = pow(b, m) x0 = x / bm x1 = x % bm y0 = y / bm y1 = y % bm z2 = mult(x1, y1, b, m) z0 = mult(x0, y0, b, m) z1 = mult(x1 + x0, y1 + y0, b, m) - z2 - z0 return mult(z2, bm ** 2, b, m) + mult(z1, bm, b, m) + z0 What I don't get is: how should z2 , z1 , and z0 be created? Is using the mult