Function Kata "Russian pawn multiplication"

Write a function that multiplies two integers using the "Russian pawn multiplication" algorithm.

The signature of the method is as follows:

int Mul(int x, int y);

The algorithm of the so-called Russian pawn multiplication proceeds as follows: the left of the two numbers is halved until 1 is reached. Decimal places are rounded down. The right-hand number is written next to it and doubled. All the numbers on the right next to which there is an even number on the left are crossed out. The remaining numbers on the right-hand side that have not been crossed out are then added together to form the result of the multiplication.

Example:

en_USEnglish