What is the Cranes and Tortoises Problem?
The cranes-and-tortoises problem (known in Japanese as "tsurukamezan") is a classic elementary-school word problem. You are told the total number of heads and the total number of legs of a mixed group of cranes and tortoises. A crane has 2 legs and a tortoise has 4 legs. The puzzle is to work out how many of each animal there are. Although it has a charming cultural framing, the math is universal: it is simply a system of two linear equations in two unknowns.
How to use this calculator
Enter the total number of heads and the total number of legs. The legs per crane (2) and legs per tortoise (4) are pre-filled but you can change them to model other variations of the puzzle. The calculator instantly returns the number of cranes and tortoises, and verifies the leg count for you.
The formula explained
Let \(H\) be the total heads, \(L\) the total legs, \(a\) the legs per crane and \(b\) the legs per tortoise. We have two equations: \(\text{cranes} + \text{tortoises} = H\), and \(a\cdot\text{cranes} + b\cdot\text{tortoises} = L\). Solving the system gives
$$\text{Cranes} = \frac{b\,H - L}{b - a}, \qquad \text{Tortoises} = \frac{L - a\,H}{b - a}$$A valid whole-animal answer requires both results to be non-negative integers, which means the total legs must lie between \(2\times\text{heads}\) and \(4\times\text{heads}\).
Worked example
Suppose there are 8 heads and 26 legs. Then
$$\text{Cranes} = \frac{4\times 8 - 26}{4 - 2} = \frac{32 - 26}{2} = 3, \qquad \text{Tortoises} = 8 - 3 = 5$$Checking: \(3\times 2 + 5\times 4 = 6 + 20 = 26\) legs, and \(3 + 5 = 8\) heads. So there are 3 cranes and 5 tortoises.
FAQ
Why might there be no solution? If the legs are not between \(2\times\text{heads}\) and \(4\times\text{heads}\), one animal count comes out negative, which is impossible. Also, with 2 and 4 legs the total legs must be even, otherwise the counts are not whole numbers.
Can I solve other animal mixes? Yes. Change "legs per crane" and "legs per tortoise" to any two different values, for example 2 (chicken) and 4 (rabbit), and the same method works.
What if all animals are the same type? If \(\text{legs} = 2\times\text{heads}\) then every animal is a crane; if \(\text{legs} = 4\times\text{heads}\) then every animal is a tortoise.