The number that leaves 2 mod 3, 3 mod 5 and 2 mod 7 is 23, by Sunzi's rule

Sunzi's remainder puzzle from the Mathematical Manual: 70·2 + 21·3 + 15·2 = 233, and 233 mod 105 is 23.

Equations and algebra · Level: Classic result · Updated on 2026-11-10

The rule handed down with the problem is a recipe, not a search. Take the three remainders 2, 3, 2 and multiply them by 70, 21 and 15 — numbers chosen so that 70 ≡ 1 (mod 3) and 0 elsewhere, 21 ≡ 1 (mod 5), 15 ≡ 1 (mod 7). The workbench adds 70·2 + 21·3 + 15·2 to 233; subtract two lots of 3·5·7 = 105 and 23 is left, which is the smallest answer. Check it the other way: 23 mod 3 is 2, 23 mod 5 is 3, 23 mod 7 is 2.

The theorem says the system has exactly one solution modulo the product of coprime moduli, so 23 is the only answer between 0 and 104 and every other solution is 23 + 105k. The construction generalises to any number of congruences, and the same algebra appears far from arithmetic: it is the Chinese remainder isomorphism Z/105 → Z/3 × Z/5 × Z/7, the reason a number can be hashed against several small moduli at once, and the backbone of the explicit reconstruction step in residue-number-system arithmetic used for exact summation.

Answer

23

How to read it

233 mod 105 on the workbench. The first link builds 233 from the coefficients 70, 21 and 15 of the verse rule; the third prints the first of the three remainders, 2.

Source

Sunzi suanjing (Master Sun's Mathematical Manual, c. 400 CE) poses the problem 'there is an unknown number, divided by 3 it leaves 2, divided by 5 it leaves 3, divided by 7 it leaves 2'; the general constructive rule appears in Qin Jiushao's Shushu Jiuzhang of 1247, and the theorem in its modern form belongs to Euler's work on congruences before Gauss put it in the Disquisitiones Arithmeticae of 1801 — which is why the theorem is called Chinese in the West

Work it in the calculator

These links open the right calculator with this problem's numbers already typed in. The line above is what the screen should show — check it yourself.

This is an independent third-party tool site. It is not affiliated with, sponsored by, or authorised by Casio, Texas Instruments or their distributors. Model names and product names are trademarks of their respective owners and appear here only to identify devices.

The keystroke sequences in these manuals were written from this site's own layout data — the same data the online calculator renders — plus publicly available product facts. Specifications and regional configurations are confirmed against the physical device and the manufacturer's most recent material.