Your question is Recursive Multiplication Without Operators. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Thales TopSky-ATC contains performance-sensitive numerical routines where an arithmetic multiplication primitive may be unavailable or restricted. Implement multiplication of two positive integers using recursion while minimizing the number of arithmetic operations.
You must not use Python's *, /, or // operators. Bit shifts, addition, subtraction, comparisons, and bitwise operators are allowed.
Implement recursive_multiply(a, b), where a and b are positive integers. Return the integer product a × b. The implementation must be recursive and should reduce the number of recursive calls by processing the smaller operand as the multiplier when useful.
A zero multiplier may occur in recursive subproblems, so the base case must return zero when the multiplier reaches zero.
def recursive_multiply(a, b):