0

I know about Karatuba's algorithm and other even more efficient ways to multiply two large polynomials or integers.

I also know that there is a "middle product" version of Karatsuba which computes only the middle bits (or digits) of a product more efficiently.

But is there an efficient way to compute only the most significant half of a product?

E.g. if I have two n-bit (n-digit) numbers (or polynomials in GF(2)[x]) a and b, how can I compute the n most significant bits of p = a*b efficiently (more efficient than computing all 2n digits (or 2n-1 bits) of p)

  • Break a and b in two halves and multiply. You'll get four subproducts, and the subproduct of the two lower halves gets discarded so you don't need to compute it all. – President James K. Polk Jan 08 '22 at 01:12
  • @PresidentJamesK.Polk Lower bits are indeed discarded, but I think carry can affect the higher bits the OP needs? – Soonts Jan 08 '22 at 13:24
  • I was hoping for some variant of Karatsuba that would somehow construct one "upper half product" from three half-size upper (or lower) half products (plus additions/subtractions/bit reversals/other linear time things). Polks construct consists of two half-size upper half products and one half-size full product. Asymptotically, for large numbers, the multiplications needed will be O(n^1.58) just like Karatsuba, if I'm not mistaken, assuming you use Karatsuba for the full multiplication. But a split into three equally expensive but half-sized multiplications would be even more nice. – Oskar Enoksson Jan 10 '22 at 14:49

0 Answers0