Karatsuba operand splitting

ID: karatsuba-operand-splitting

Fix an integer base . Let have at most digits in positional notation, treating zero as one digit. For , set using the ceiling function, and . Euclidean division gives
where and . The floor function selects the high block; the remainder selects the low block. Both operands must use the same , including when their actual digit lengths differ.
For odd , the low block has digit positions and the high block has . Leading zero padding aligns a shorter operand without changing its integer value. Padding to a power-of-two length is optional: the split itself works for every . If power-of-two padding is used, the padded length is less than twice the original length, so it changes only a constant factor in the asymptotic analysis.

New to topics? Read the docs here!