Russian Peasant Multiplication Calculator
Multiply any two numbers using the ancient halving & doubling algorithm. See every step and the binary connection.
What Is Russian Peasant Multiplication?
Russian Peasant Multiplication — also known as Egyptian multiplication, Ethiopian multiplication, or binary multiplication — is an ancient algorithm for multiplying two integers that requires nothing more than the ability to halve a number, double a number, and add. Unlike standard multiplication which relies on memorized times tables, this method reduces every multiplication problem to a sequence of halvings, doublings, and additions.
The algorithm's elegance lies in what it reveals: it is actually computing a binary multiplication in disguise. The rows you keep (where A is odd) correspond exactly to the positions of 1-bits in the binary representation of A. Summing those rows reconstructs A×B as a sum of powers-of-two times B — the very computation a digital computer performs when multiplying two integers in hardware.
Step-by-Step: How It Works
To multiply A × B using the Russian Peasant method:
- Write A in the left column and B in the right column.
- On each new row: halve A (discard any remainder) and double B.
- Continue until A reaches 1.
- Cross out (mark as discarded) every row where A is even.
- Add up all the B values in the rows where A is odd. This sum is the product A×B.
Example: 7 × 13. Start with A=7, B=13. Since 7 is odd, keep 13. Next: A=3 (⌊7/2⌋), B=26. Since 3 is odd, keep 26. Next: A=1, B=52. Since 1 is odd, keep 52. A has reached 1 — stop. Sum = 13 + 26 + 52 = 91 = 7 × 13. Correct!
The Binary Connection
The deep reason the algorithm works is that any integer A can be written in binary: A = bâ‚€ + bâ‚×2 + b₂×4 + b₃×8 + ... where each báµ¢ is 0 or 1. Therefore:
A × B = (b₀×B) + (bâ‚×2B) + (b₂×4B) + (b₃×8B) + ...
The doubling column produces B, 2B, 4B, 8B, ... — exactly the terms. The halving column repeatedly divides A by 2; whenever the remainder is 1 (A is odd), the corresponding bit bᵢ = 1 and that row's doubled value is included in the sum. Rows where A is even have bᵢ = 0 and are discarded. The algorithm is therefore a direct implementation of binary multiplication, performed by hand without needing to know binary explicitly.
For example, 7 in binary is 111₂ = 4+2+1. So 7×13 = 4×13 + 2×13 + 1×13 = 52 + 26 + 13 = 91. Notice these are exactly the three kept rows in the algorithm above!
History: Ancient Egypt to Modern Computing
The earliest known written record of this algorithm appears in the Rhind Mathematical Papyrus (also called the Ahmes Papyrus), an ancient Egyptian document dated to approximately 1650 BCE. The papyrus shows Egyptian scribes solving multiplication problems exclusively through doubling — they would double a number repeatedly and then select the appropriate doublings to sum to reach a target product.
The same technique was independently discovered or transmitted to Ethiopia (where it is still called Ethiopian multiplication in some regions) and later to Russia, where it was reportedly used by peasants and merchants as late as the early 20th century — people who needed to multiply but had not learned formal multiplication tables. Charles Peirce, the American logician, described the method in the 19th century and recognized its logical beauty.
In the computer age, the algorithm returned to prominence as the theoretical basis for hardware multipliers. Every modern CPU uses shift-and-add circuits that implement exactly this algorithm: shifting left multiplies by 2 (doubling), shifting right divides by 2 (halving), and conditional accumulation handles the sum of kept rows.
Comparison with Standard Multiplication
| Aspect | Russian Peasant | Standard (Long) Multiplication |
|---|---|---|
| Prerequisites | Halving, doubling, addition only | Times tables 0–9 memorized |
| Steps for n-digit numbers | O(log₂ A) halvings + additions | O(n²) digit multiplications |
| Error susceptibility | Easy to verify each step | Errors in times table recall possible |
| Educational value | Reveals binary structure of numbers | Builds place-value understanding |
| Computer analogy | Directly maps to shift-and-add | Requires digit lookup tables |
Applications in Computer Science
The Russian Peasant algorithm directly inspired several important areas of computer science. Hardware multipliers in CPUs use a variant called shift-and-add multiplication, where a left shift doubles a number (equivalent to the doubling column) and testing the least-significant bit identifies odd numbers (equivalent to checking the halving column). This makes multiplication O(log n) operations in the number of bits.
Fast exponentiation (also called exponentiation by squaring) applies the same idea to powers: compute aâ¿ by repeatedly squaring and selecting which squares to multiply together based on the binary representation of n. This is fundamental to RSA cryptography, where modular exponentiation with 2048-bit exponents must be computed efficiently. The Russian Peasant multiplication algorithm, thousands of years old, is thus at the heart of every secure HTTPS connection you make today.