See How Things Work

Sunzi's remainder problem

Unit
Mathematics in Asia
Part
1. China
Lesson
1.3

A short Chinese arithmetic book, probably of the third to fifth century CE, asks for a number of things that leave 2 over when counted in threes, 3 over when counted in fives, and 2 over when counted in sevens.⁠[1][2] This puzzle, and the recipe the book gives for it, began a long history that led to a general method in thirteenth-century China and, much later, to a theorem named after China.⁠[3][4] This lesson tells that story.

Master Sun’s manual

The book is the Sunzi suanjing, “Sun Zi’s Mathematical Manual” (in older spelling, Sun-Tsu).⁠[5][6] Nothing is known about its author except the book itself.⁠[5] In the seventeenth century he was identified with Sun Wu, the military writer of the sixth century BCE known for The Art of War,⁠[7] but references in some of its problems show that the book is much later, and the identification is now rejected.⁠[8]

The manual has three chapters. The first describes systems of measurement and explains how to multiply, divide and find square roots with counting rods. The second and third chapters contain problems, 28 and 36 of them, of the same kinds as those of the Nine Chapters but on the whole easier.⁠[9][10] The manual is also the source of the rule that the rods for the ones stand upright, the rods for the tens lie flat, the hundreds stand upright again, and so on.⁠[6]

Looking ahead.

Rod numerals and their alternation are explained in “Chinese numerals and counting rods” (unit Numeral Systems); the Nine Chapters in the first lesson of this unit.

Caution.

The date of the manual is uncertain, and books give very different ones. Burton, and Rosen in his Discrete Mathematics, place Sun-Tsu in the first century;⁠[11][12] the Dictionary of Scientific Biography puts the problem “about the fourth century”;⁠[13] the MacTutor archive’s overview of Chinese mathematics dates Sun Zi to about 400–460.⁠[14] The MacTutor biography of Sun Zi explains the difficulty. The historian Wang Ling noted that the book mentions taxes first introduced in 280 and still uses a scale of measures replaced in 474, so that the text as we have it was written between those dates.⁠[15][16] But the book was probably compiled from older material and added to later: a bibliography of 636 gives it two chapters, not three.⁠[17][18] Modern specialists suggest the third century, the third or fourth, about 400, or the fifth, and one sets it “somewhere between the 3rd and 5th centuries”.⁠[1][19] This lesson follows that range. (The MacTutor archive also credits Shen Kangsheng with the precise date 237;⁠[1] but in Shen’s article of 1988 on the history of the remainder theorem, which MacTutor lists among its references, 237 is the year of the Jingchu calendar, not of the manual.⁠[20])

Example (Wang Ling’s window).
  1. The taxes the book mentions were first established in 280, so the text cannot be earlier than 280.⁠[15]
  2. The book still uses a scale of measures that was replaced in 474, so it cannot be later than 473.⁠[16]
  3. From 280 to 473: 280 + 193 = 473, a window of about two centuries.

The argument dates only the parts of the text that mention these things. If the book was put together from older pieces and added to later, other parts may be older or younger, which is why the experts still disagree.⁠[17]

Problem 26

The twenty-sixth problem of the third chapter reads, in our words: there are some things whose number is not known. Counted in threes, 2 are left over; counted in fives, 3 are left over; counted in sevens, 2 are left over. How many things are there?⁠[2][21] The book’s answer is 23.⁠[22]

Definition (Leftover (remainder)).

When a number of things is counted off in groups of the same size, the things that do not make a full group are left over. Their number is always smaller than the size of a group, and it may be zero.⁠[23] Today it is called the remainder.⁠[24]

In threes7 groups, 2 left over

In fives4 groups, 3 left over

In sevens3 groups, 2 left over

Twenty-three things counted off three ways. In threes: 7 full groups and 2 left over. In fives: 4 full groups and 3 left over. In sevens: 3 full groups and 2 left over. These are exactly the leftovers of Sunzi’s problem, and 23 is the book’s answer.⁠[2][22]
Example (Checking 23 by counting).
  1. In threes: 3, 6, 9, 12, 15, 18, 21 make 7 full groups, and 21 + 2 = 23, so 2 are left over.
  2. In fives: 5, 10, 15, 20 make 4 full groups, and 20 + 3 = 23, so 3 are left over.
  3. In sevens: 7, 14, 21 make 3 full groups, and 21 + 2 = 23, so 2 are left over.

All three leftovers are those of the problem, so 23 is an answer.

Twenty-three fits. But how could it be found without trying every number? In the game below, try it yourself: change the number of things, one or ten at a time, and watch the three leftovers change. Each round asks for different leftovers; the first round is Sunzi’s.

Game

Counting off in threes, fives and sevens

Round
1
Score
0
Streak
0

Choose how many things there are. They are counted off in threes, in fives and in sevens; the things left over are shown in red. Change the number until all three leftovers are the ones asked for, then press Check.

Sunzi’s problem: there are some things; counted in threes, 2 things are left over; in fives, 3 things are left over; in sevens, 2 things are left over. How many things are there?⁠[2]

Showing 1 thing.

In threes0 groups, 1 left over (wanted: 2)

In fives0 groups, 1 left over (wanted: 3)

In sevens0 groups, 1 left over (wanted: 2)

Looking ahead.

Counting off with leftovers is division with remainder, taught in “Division with remainder” (unit Division). Problems like Sunzi’s are solved in general in “The Chinese remainder theorem” (unit Congruences).

Sunzi’s recipe

The manual does more than state the answer. It gives a recipe that works for any leftovers when things are counted in threes, fives and sevens.⁠[22][25] In words:

  • for each thing left over when counting in threes, take 70;
  • for each thing left over when counting in fives, take 21;
  • for each thing left over when counting in sevens, take 15;
  • add everything up; if the total is 106 or more, take away 105, again and again, until it is 105 or less.⁠[25][26]

The three numbers are well chosen, and counting shows why. Seventy counted in fives makes 14 full groups with nothing over, and in sevens 10 full groups with nothing over, but in threes it makes 23 full groups and 1 over (69 + 1 = 70). In the same way 21 leaves 1 over only in fives (20 + 1), and 15 leaves 1 over only in sevens (14 + 1). And 105 leaves nothing over in threes, fives or sevens (35, 21 and 15 full groups).

Example (Sunzi’s recipe for Sunzi’s problem).

The manual itself works the problem in these steps.⁠[27]

  1. 2 left over in threes: 70 + 70 = 140.
  2. 3 left over in fives: 21 + 21 + 21 = 63.
  3. 2 left over in sevens: 15 + 15 = 30.
  4. Add: 140 + 63 + 30 = 233.
  5. 233 is 105 + 105 + 23, so taking away 105 twice (210 in all) leaves 23, the book’s answer.
Example (The smallest leftovers, and none at all).
  1. Leftovers 1, 1 and 1: 70 + 21 + 15 = 106. That is 105 or more, and 106 = 105 + 1, so the recipe gives 1. Check: a single thing counted in threes, fives or sevens makes no full group and leaves 1 over each time.
  2. Leftovers 0, 0 and 0: nothing is taken, and the total is 0. Zero things leave nothing over, but a heap of things is not empty. The next number that fits is 0 + 105 = 105, which makes 35 full groups of three, 21 of five and 15 of seven.

The threshold 106 keeps the result between 1 and 105: a total is reduced only while it is 106 or more, so it is never brought down to 0. Only the leftovers 0, 0 and 0 give a total of 0, and then the answer is 105, as above. When the group sizes share no common measure, as 3, 5 and 7 do not, every choice of leftovers has exactly one answer from 1 to 105, the number of things that make full groups of all three sizes at once.⁠[28]

Example (A tempting mistake: why 70 and not 35).

Thirty-five also leaves nothing over in fives (7 full groups) and in sevens (5 full groups), and it is smaller than 70. Why does the recipe not use it?

  1. Count 35 in threes: 3, 6, …, 33 make 11 full groups, and 33 + 2 = 35, so 35 leaves 2 over, not 1.
  2. Then “35 for each thing left over in threes” would give 35 + 35 = 70 for Sunzi’s 2 leftovers, and 70 leaves 1 over in threes, not 2. The recipe would fail.
  3. 70 = 35 + 35 leaves 2 + 2 = 4 over before regrouping, which makes one more full group of three and 1 over. That single leftover is what the recipe needs.
Intuition.

Why does the recipe work? Adding a pile that leaves nothing over in fives does not change what is left over in fives: its full groups simply join the others. Seventy and fifteen leave nothing over in fives, so in 140 + 63 + 30 only the 63 decides the leftover in fives, and 63 is three twenty-ones, each leaving 1 over. The same reasoning works for threes and sevens. Taking away 105 changes no leftover, for the same reason. This is a picture, not a proof; the proof belongs to the theorem named in the Looking ahead note above.

The manual does not say how the numbers 70, 21 and 15 were found. The historian Shen Kangsheng judges that they were found by trial and error, and that Sun Zi’s solution, though correct, was a single numerical example rather than a general rule.⁠[29] The MacTutor archive stresses the other side: the solution, although given for one case, is exactly the modern method.⁠[30]

Caution.

The MacTutor archive calls Sunzi’s problem the earliest known occurrence of this type of problem.⁠[31][32] Burton, in his Elementary Number Theory, says that the same problem occurs in the Introduction to Arithmetic of the Greek mathematician Nicomachus, about 100 CE.⁠[33] The two sources disagree; since the date of Sunzi’s manual is itself uncertain, the question of which is older cannot be settled here.

From a puzzle to a general method

Problems of this kind were not only puzzles. Chinese astronomers needed them for the calendar. By the middle of the third century, calendar makers counted from a starting moment in the past, the Grand Cycle, when the winter solstice fell at midnight on the first day of the eleventh month, which was also the first day of a sixty-day cycle; to find how many years had passed since then, they had to find a number with given leftovers when counted in different cycles.⁠[34][35] Shen Kangsheng writes that such calculations were needed for calendars as early as the second century BCE, describes them in the Jingchu calendar of 237,⁠[20] and judges that Sun Zi’s problem, although it says nothing about astronomy, was born from them.⁠[36]

The general method came in 1247, in the Mathematical Treatise in Nine Sections of Qin Jiushao,⁠[37][38] an official who became governor of two provinces and was dismissed from one of them for bribery and corruption.⁠[39] His treatise opens with the dayan qiuyi rule, which Shen translates as the “rule of finding unity”.⁠[40][41][42] It finds the numbers that play the part of 70, 21 and 15 for any groups whatever, and it handles groups whose sizes share a common measure (for example 12 and 18; see the exercises), which Sun Zi’s recipe cannot.⁠[43][44] The historian Ulrich Libbrecht, quoted by MacTutor, calls it a revolutionary advance: “from [Sun Zi’s] single remainder problem, we come at once to the general procedure”.⁠[3] Qin did not claim the method as his own: he says he learned it from calendar experts, who used the rule without understanding it.⁠[45][46]

The puzzle also became popular. In 1275 Yang Hui gave four problems in imitation of Sun Zi’s, one of them with four countings (in twos, fives, sevens and nines),⁠[47] and he recorded the names people used for such problems in his time, among them “the Prince of Qin’s secret method of counting soldiers” and “the method of cutting lengths of tube”.⁠[48]

Example (Yang Hui’s four countings).

Yang Hui’s fourth problem asks for things that leave 1 over in twos, 2 over in fives, 3 over in sevens and 4 over in nines; Shen gives his answer as 157.⁠[47][49] Check it by counting:

  1. In twos: 78 full groups make 156, and 156 + 1 = 157, so 1 is left over.
  2. In fives: 31 full groups make 155, and 155 + 2 = 157, so 2 are left over.
  3. In sevens: 22 full groups make 154, and 154 + 3 = 157, so 3 are left over.
  4. In nines: 17 full groups make 153, and 153 + 4 = 157, so 4 are left over.

All four leftovers fit. (The group sizes 2, 5, 7 and 9 share no common measure, so a recipe like Sunzi’s, with four numbers instead of three, would also work here.)

Historical note.

Remainder problems appear elsewhere too: in the work of Ibn al-Haytham, about 1000, and in Leonardo of Pisa’s (Fibonacci’s) Liber Abaci (1202), without any general explanation.⁠[50][51] A rule like Qin Jiushao’s is found in a German manuscript of about 1550 kept at Göttingen,⁠[52] but the general study of such problems in Europe came in the eighteenth century, with Euler and Lagrange,⁠[53] and in Gauss’s Disquisitiones Arithmeticae of 1801.⁠[54] The West learned of Qin Jiushao’s rule in the nineteenth century through the writings of Alexander Wylie, and the mathematician Matthiessen then pointed out that it agrees with Gauss’s.⁠[55]

Caution.

The name “Chinese remainder theorem” is a later name, given in honor of the early Chinese work: the theorem is so called because special cases of it appear in Sun Zi’s manual and in Qin Jiushao’s treatise.⁠[4][28][56]

Exercises

Exercise .

Why does Sunzi’s recipe take 21 for each thing left over when counting in fives?

▸ Show solution

In fives, 21 makes 4 full groups and leaves 1 over (20 + 1). In threes it makes exactly 7 groups and in sevens exactly 3 groups, with nothing over. So 21 leaves 1 over only when counted in fives, which is why the recipe takes 21 for each thing left over in fives.

Exercise .

Use Sunzi’s recipe to find a number that leaves 1 over in threes, 2 over in fives and 3 over in sevens. Then check your answer by counting.

▸ Show solution

1 over in threes: 70. 2 over in fives: 21 + 21 = 42. 3 over in sevens: 15 + 15 + 15 = 45. Total: 70 + 42 + 45 = 157 = 105 + 52, so the answer is 52. Check: 52 in threes is 17 groups and 1 over (51 + 1); in fives 10 groups and 2 over (50 + 2); in sevens 7 groups and 3 over (49 + 3).

Exercise .

Why is 128 also an answer to Sunzi’s problem? Are there others?

▸ Show solution

105 counted in threes, fives or sevens leaves nothing over (35, 21 and 15 full groups). Adding 105 to 23 adds only full groups, so 128 has the same leftovers as 23. The same holds for 233, 338 and so on: the problem has many answers, and 23 is the smallest. Burton notes that Sun Zi gave only 23.⁠[57]

Exercise .

Is there a number that leaves 1 over when counted in twelves and 2 over when counted in eighteens? (Hint: count both kinds of numbers in sixes.)

▸ Show solution

Count in twelves and eighteens. A number that leaves 1 over in twelves is one of 13, 25, 37, …: each is 12 more than the one before. Counted in sixes, each of these leaves 1 over, because 12 is two full groups of six. A number that leaves 2 over in eighteens is one of 20, 38, 56, …, and counted in sixes each leaves 2 over, because 18 is three full groups of six. No number can leave both 1 and 2 over when counted in sixes, so no number fits. Sizes that share a common measure (here 6) need the extra care that Qin Jiushao’s rule provides.

Exercise .

Why do the books cited in this lesson date Sun Zi anywhere from the first to the fifth century?

▸ Show solution

Because the book gives no date and nothing is known of its author, and because the text was probably compiled from older material and changed over time. Dates can only be inferred from its contents: Wang Ling’s argument from the taxes and measures it mentions gives 280 to 473 for the text as we have it, but older parts may be earlier and some parts later. Different historians weigh this evidence differently, and older books repeat older estimates.

Summary

  1. The Sunzi suanjing (“Sun Zi’s Mathematical Manual”) is a short arithmetic book of uncertain date, probably between the third and fifth centuries CE; nothing is known of its author.⁠[1][5]
  2. Its Problem 26 of chapter 3 asks for things that leave 2 over in threes, 3 over in fives and 2 over in sevens; the answer given is 23.⁠[2][22]
  3. Its recipe takes 70, 21 and 15 for each thing left over in threes, fives and sevens, adds, and takes away 105 as often as possible. Each of the three numbers leaves 1 over in one counting and nothing in the other two.⁠[25]
  4. In 1247 Qin Jiushao gave a general method, the dayan qiuyi rule, for any groups; Europe reached a general treatment only with Euler, Lagrange and Gauss (1801).⁠[40][53][54]
  5. The name “Chinese remainder theorem” honors these early Chinese texts.⁠[4][56]

Sources

  1. 1.
    J. J. O’Connor and E. F. Robertson, “Sun Zi”, MacTutor History of Mathematics Archive, University of St Andrews (last update December 2003).
    “Berezkina [5] says it was 'composed in the third or fourth century of our era'; Lam in [6] says 'Sun Zi (somewhere between the 3rd and 5th centuries AD) ...'; while Shen [9] gives the very precise date for the Sunzi suanjing of 237 AD.”
    Used for: modern dates for the manual: the third or fourth century (Berezkina), between the third and fifth centuries (Lam); MacTutor’s report of the date 237 from Shen (its reference [9], Shen’s article of 1988).
  2. 2.
    J. J. O’Connor and E. F. Robertson, “Sun Zi”, MacTutor History of Mathematics Archive, University of St Andrews (last update December 2003).
    “Suppose we have an unknown number of objects. When counted in threes, 2 are left over, when counted in fives, 3 are left over, and when counted in sevens, 2 are left over. How many objects are there?”
    Used for: Problem 26 of chapter 3 (MacTutor: “this being Problem 26 in Chapter 3”), in MacTutor’s translation (lead, text, figure and game).
  3. 3.
    J. J. O’Connor and E. F. Robertson, “Qin Jiushao”, MacTutor History of Mathematics Archive, University of St Andrews (last update December 2003).
    “We should not underestimate [Qin's] revolutionary advance, because from [Sun Zi's] single remainder problem, we come at once to the general procedure for solving the remainder problem”
    Used for: Libbrecht’s judgment, quoted by MacTutor: Qin Jiushao’s general procedure as a revolutionary advance on Sun Zi’s single problem.
  4. 4.
    George S. Boolos, John P. Burgess and Richard C. Jeffrey, Computability and Logic (4th ed., Cambridge University Press, 2002).
    Chapter 16, “Representability of Recursive Functions”, section 16.1, “Arithmetical Definability”, p. 203 (the whole topic: pp. 203–204).
    “The first ingredient is the Chinese remainder theorem, so called from the appearance (at least of special cases) of the theorem in the ancient Mathematical Classic of Sun Zi and the medieval Mathematical Treatise in Nine Sections of Qin Jiushao.”
    Used for: the name “Chinese remainder theorem”, from the special cases in Sun Zi’s manual and Qin Jiushao’s treatise.
  5. 5.
    J. J. O’Connor and E. F. Robertson, “Sun Zi”, MacTutor History of Mathematics Archive, University of St Andrews (last update December 2003).
    “Nothing is known about Sun Zi except his text Sunzi suanjing (Sun Zi's Mathematical Manual).”
    Used for: the title Sunzi suanjing, “Sun Zi’s Mathematical Manual”; nothing known of the author except the book.
  6. 6.
    Florian Cajori, A History of Mathematical Notations (two volumes bound as one, Dover (first published by Open Court, 1928–1929), 1993).
    Vol. I, Chapter II, “Numeral Symbols and Combinations of Symbols”, section “China and Japan”, §72, p. 44 (the whole topic: pp. 43–44).
    “According to the Chinese author Sun-Tsu, units are represented, as just shown, by vertical rods, ten’s by horizontal rods, hundred’s again by vertical rods, and so on.”
    Used for: the rule of alternating upright and lying rods, stated by Sun-Tsu (Sun Zi).
  7. 7.
    J. J. O’Connor and E. F. Robertson, “Sun Zi”, MacTutor History of Mathematics Archive, University of St Andrews (last update December 2003).
    “In the 17th century Sun Zi was identified with Sun Wu, a famous military expert of the sixth century BC who wrote Sun Zi's art of war.”
    Used for: the seventeenth-century identification with Sun Wu, the military writer of the sixth century BCE.
  8. 8.
    J. J. O’Connor and E. F. Robertson, “Sun Zi”, MacTutor History of Mathematics Archive, University of St Andrews (last update December 2003).
    “certainly realised that references in certain problems in the Sunzi suanjing meant that the identification with Sun Wu was incorrect.”
    Used for: the identification rejected because of references in some problems (Ruan Yuan, 1799).
  9. 9.
    J. J. O’Connor and E. F. Robertson, “Sun Zi”, MacTutor History of Mathematics Archive, University of St Andrews (last update December 2003).
    “The first chapter describes systems of measuring with considerable detail, and gives instructions on using counting rods to multiply, divide, and compute square roots.”
    Used for: the three chapters; the first on measures and on multiplying, dividing and finding square roots with counting rods.
  10. 10.
    J. J. O’Connor and E. F. Robertson, “Sun Zi”, MacTutor History of Mathematics Archive, University of St Andrews (last update December 2003).
    “The second and third chapters consist of problems (28 problems and 36 problems respectively) concerning fractions, areas, volumes etc. similar to, but rather easier than, the problems in the Nine Chapters on the Mathematical Art.”
    Used for: the second and third chapters with 28 and 36 problems, easier than those of the Nine Chapters.
  11. 11.
    David M. Burton, The History of Mathematics: An Introduction (7th ed., McGraw-Hill, 2011).
    Chapter 5, “The Twilight of Greek Mathematics: Diophantus”, section 5.3, “Diophantine Equations in Greece, India, and China”, “The Chinese Hundred Fowls Problem”, p. 229 (the whole topic: pp. 228–230).
    “The type of word puzzle that involves simultaneous linear diophantine equations has a long history, appearing in the Chinese literature as early as the first century.”
    Used for: Burton’s date for such puzzles in Chinese writing, as early as the first century (followed by Sun-Tsu’s problem).
  12. 12.
    Kenneth H. Rosen, Discrete Mathematics and Its Applications (8th ed., McGraw-Hill, 2019).
    Chapter 4, “Number Theory and Cryptography”, section 4.4, “Solving Congruences”, p. 291 (the whole topic: pp. 290–297).
    “For example, the Chinese mathematician Sun-Tsu studied them in the first century.”
    Used for: Rosen’s date for Sun-Tsu, the first century.
  13. 13.
    Ho Peng-Yoke, “Ch’in Chiu-shao”, Complete Dictionary of Scientific Biography (Charles Scribner’s Sons; copy at the MacTutor archive) (2008).
    “It had first appeared in Chinese mathematical texts about the fourth century in a problem in the Sun-tzu suan ching”
    Used for: the Dictionary’s date, about the fourth century.
  14. 14.
    J. J. O’Connor and E. F. Robertson, “Overview of Chinese mathematics”, MacTutor History of Mathematics Archive, University of St Andrews (last update December 2003).
    “For example Sun Zi (about 400 - about 460) wrote his mathematical manual the Sunzi suanjing”
    Used for: the MacTutor overview’s dates for Sun Zi, about 400 to about 460.
  15. 15.
    J. J. O’Connor and E. F. Robertson, “Sun Zi”, MacTutor History of Mathematics Archive, University of St Andrews (last update December 2003).
    “The Sunzi suanjing mentions the mein as an item of taxation, and the hu tiao system. These two were first established in 280 AD. So the book could not have been written before this date.”
    Used for: Wang Ling’s argument: taxes first introduced in 280 (text and example).
  16. 16.
    J. J. O’Connor and E. F. Robertson, “Sun Zi”, MacTutor History of Mathematics Archive, University of St Andrews (last update December 2003).
    “A new scale between chih and tuan was established in 474 AD; the Sunzi, still using the old scale by Wu Ch'en-Shih's emendation, cannot be older than 473 AD.”
    Used for: Wang Ling’s argument: the old scale of measures, replaced in 474, so the text no later than 473 (text and example).
  17. 17.
    J. J. O’Connor and E. F. Robertson, “Sun Zi”, MacTutor History of Mathematics Archive, University of St Andrews (last update December 2003).
    “Of course this dating assumes that the text was written as a whole, while it seems more likely that it was compiled, like many of the texts, from older sources.”
    Used for: the book probably compiled from older sources, so that a date fits only part of it.
  18. 18.
    J. J. O’Connor and E. F. Robertson, “Sun Zi”, MacTutor History of Mathematics Archive, University of St Andrews (last update December 2003).
    “This theory is supported by the fact that in a bibliography compiled in 636 it is stated that the Sunzi suanjing has two chapters while today's version has three.”
    Used for: the bibliography of 636 giving two chapters, against three today.
  19. 19.
    J. J. O’Connor and E. F. Robertson, “Sun Zi”, MacTutor History of Mathematics Archive, University of St Andrews (last update December 2003).
    “What of the modern texts? Lam and Ang in [1] suggest it is a '3rd century AD treatise'; Martzloff in [2] (also [3]) gives 'fifth century very approximately'; Bag and Shen [4] say 'About 400 AD a Chinese mathematician, Sun Zi, took up the problem ...'”
    Used for: modern dates: the third century (Lam and Ang), the fifth (Martzloff), about 400 (Bag and Shen).
  20. 20.
    Shen Kangsheng, “Historical Development of the Chinese Remainder Theorem”, Archive for History of Exact Sciences 38(4) (1988), 285–305.
    “Congruences of first degree were necessary to calculate calendars in ancient China as early as the 2nd century B.C. Subsequently, in making the Jingchu [a] calendar (237 A.D.), the astronomers defined shangyuan [b]”
    Used for: such calculations needed for calendars from the second century BCE, and in the Jingchu calendar of 237.
  21. 21.
    Shen Kangsheng, “Historical Development of the Chinese Remainder Theorem”, Archive for History of Exact Sciences 38(4) (1988), 285–305.
    “Sun Zi suanjing (Problem 26, Volume 3) reads: “There are certain things whose number is unknown.”
    Used for: the problem as Problem 26 of the third volume (chapter) of the manual (second source).
  22. 22.
    J. J. O’Connor and E. F. Robertson, “Sun Zi”, MacTutor History of Mathematics Archive, University of St Andrews (last update December 2003).
    “After solving the particular problem (the answer is 23) the Sunzi suanjing gives a method for arbitrary remainders”
    Used for: the answer 23, and a method given for any leftovers (text and figure).
  23. 23.
    Kenneth H. Rosen, Discrete Mathematics and Its Applications (8th ed., McGraw-Hill, 2019).
    Chapter 4, “Number Theory and Cryptography”, section 4.1.3, “The Division Algorithm”, p. 253 (the whole topic: pp. 253–254).
    “Let a be an integer and d a positive integer. Then there are unique integers q and r, with 0 ≤ r < d, such that a = dq + r.”
    Used for: the leftover always smaller than the size of a group, and possibly zero (0 ≤ r < d).
  24. 24.
    Kenneth H. Rosen, Discrete Mathematics and Its Applications (8th ed., McGraw-Hill, 2019).
    Chapter 4, “Number Theory and Cryptography”, section 4.1.3, “The Division Algorithm”, p. 253 (the whole topic: pp. 253–254).
    “In the equality given in the division algorithm, d is called the divisor, a is called the dividend, q is called the quotient, and r is called the remainder.”
    Used for: the name remainder.
  25. 25.
    J. J. O’Connor and E. F. Robertson, “Sun Zi”, MacTutor History of Mathematics Archive, University of St Andrews (last update December 2003).
    “Multiply the number of units left over when counting in threes by 70, add to the product of the number of units left over when counting in fives by 21, and then add the product of the number of units left over when counting in sevens by 15. If the answer is 106 or more then subtract multiples of 105.”
    Used for: the recipe of the manual, in MacTutor’s translation.
  26. 26.
    Ho Peng-Yoke, “Ch’in Chiu-shao”, Complete Dictionary of Scientific Biography (Charles Scribner’s Sons; copy at the MacTutor archive) (2008).
    “For each 1 as a remainder, when counting by threes, put 70. For each 1 as a remainder, when counting by fives, put 21. For each 1 as a remainder, when counting by sevens, put 15. If the sum is 106 or more, subtract 105 from it, and you have the result.”
    Used for: the recipe, in the Dictionary’s translation (second source).
  27. 27.
    Ho Peng-Yoke, “Ch’in Chiu-shao”, Complete Dictionary of Scientific Biography (Charles Scribner’s Sons; copy at the MacTutor archive) (2008).
    “If you count by threes and have the remainder 2, put 140. If you count by fives and have the remainder 3, put 63. If you count by sevens and have the remainder 2, put 30. Add these numbers, and you get 233. From this subtract 210, and you have the result.”
    Used for: the manual’s own steps for its problem: 140, 63, 30, the total 233, and 210 taken away.
  28. 28.
    Kenneth H. Rosen, Discrete Mathematics and Its Applications (8th ed., McGraw-Hill, 2019).
    Chapter 4, “Number Theory and Cryptography”, section 4.4, “Solving Congruences”, p. 294 (the whole topic: pp. 290–297).
    “The Chinese remainder theorem, named after the Chinese heritage of problems involving systems of linear congruences, states that when the moduli of a system of linear congruences are pairwise relatively prime, there is a unique solution of the system modulo the product of the moduli.”
    Used for: exactly one answer from 1 to 105 when the group sizes share no common measure (the theorem); the name, after the Chinese problems (third source).
  29. 29.
    Shen Kangsheng, “Historical Development of the Chinese Remainder Theorem”, Archive for History of Exact Sciences 38(4) (1988), 285–305.
    “The solution was obtained by trial and error, without a general rule for a congruence of type (8). 2. There was only a numerical example, without a general rule for a system of congruences of type (1).”
    Used for: Shen’s judgment: the multipliers found by trial and error, and a single numerical example without a general rule.
  30. 30.
    J. J. O’Connor and E. F. Robertson, “Sun Zi”, MacTutor History of Mathematics Archive, University of St Andrews (last update December 2003).
    “In fact the solution given, although in a special case, gives exactly the modern method.”
    Used for: MacTutor’s judgment: the solution, though for one case, is the modern method.
  31. 31.
    J. J. O’Connor and E. F. Robertson, “Sun Zi”, MacTutor History of Mathematics Archive, University of St Andrews (last update December 2003).
    “It is the earliest known occurrence of this type of problem.”
    Used for: MacTutor: Sunzi’s problem the earliest known occurrence of its type.
  32. 32.
    J. J. O’Connor and E. F. Robertson, “Overview of Chinese mathematics”, MacTutor History of Mathematics Archive, University of St Andrews (last update December 2003).
    “However, it does contains a problem solved using the Chinese remainder theorem, being the earliest known occurrence of this type of problem.”
    Used for: the same claim in the MacTutor overview.
  33. 33.
    David M. Burton, Elementary Number Theory (7th ed., McGraw-Hill, 2011).
    Chapter 4, “The Theory of Congruences”, section 4.4, “Linear Congruences and the Chinese Remainder Theorem”, p. 79 (the whole topic: pp. 79–80).
    “Such mathematical puzzles are by no means confined to a single cultural sphere; indeed, the same problem occurs in the Introductio Arithmeticae of the Greek mathematician Nicomachus, circa 100 A.D.”
    Used for: the same problem in Nicomachus’ Introduction to Arithmetic, about 100 CE.
  34. 34.
    Ho Peng-Yoke, “Ch’in Chiu-shao”, Complete Dictionary of Scientific Biography (Charles Scribner’s Sons; copy at the MacTutor archive) (2008).
    “which was the last time that the winter solstice fell exactly at midnight on the first day of the eleventh month, which also happened to be the first day (chia-tzu, cyclical day) of a sixty-day cycle.”
    Used for: the Grand Cycle (Shang yuan) of the calendar makers, used from the middle of the third century (the sentence begins: “As early as the middle of the third century”), and the number of years since it found from leftovers.
  35. 35.
    Shen Kangsheng, “Historical Development of the Chinese Remainder Theorem”, Archive for History of Exact Sciences 38(4) (1988), 285–305.
    “Shangyuan is a supposed moment that occurred simultaneously with the midnight of jiazi [v] (the first day of the 60 day cycle), the Winter Solstice and the new moon.”
    Used for: the starting moment of the calendar: midnight, the winter solstice, the new moon and the first day of the sixty-day cycle together.
  36. 36.
    Shen Kangsheng, “Historical Development of the Chinese Remainder Theorem”, Archive for History of Exact Sciences 38(4) (1988), 285–305.
    “Sun Zi’s remainder problem had no astronomical content, but it was undoubtedly born out of astronomy.”
    Used for: Sun Zi’s problem, without astronomical content, born out of astronomy.
  37. 37.
    David M. Burton, The History of Mathematics: An Introduction (7th ed., McGraw-Hill, 2011).
    Chapter 5, “The Twilight of Greek Mathematics: Diophantus”, section 5.5, “Mathematics in the Near and Far East”, “Later Chinese Mathematical Works”, p. 259 (the whole topic: pp. 259–260).
    “One of the leading figures at this time was Ch’in Chu-shao (circa 1202–1261), who published his celebrated Mathematical Treatise in Nine Sections in 1247.”
    Used for: Qin Jiushao (Ch’in Chu-shao) and his Mathematical Treatise in Nine Sections of 1247.
  38. 38.
    J. J. O’Connor and E. F. Robertson, “Qin Jiushao”, MacTutor History of Mathematics Archive, University of St Andrews (last update December 2003).
    “Qin wrote his famous mathematical treatise Shushu Jiuzhang (Mathematical Treatise in Nine Sections) which appeared in 1247.”
    Used for: the treatise of 1247 (second source).
  39. 39.
    David M. Burton, The History of Mathematics: An Introduction (7th ed., McGraw-Hill, 2011).
    Chapter 5, “The Twilight of Greek Mathematics: Diophantus”, section 5.5, “Mathematics in the Near and Far East”, “Later Chinese Mathematical Works”, p. 260 (the whole topic: pp. 259–260).
    “Ch’in rose in officialdom to become the governor of two provinces. He was an unsavory person, reputed to poison those he found disagreeable, and was dismissed from one governorship for bribery and corruption.”
    Used for: Qin governor of two provinces, dismissed from one for bribery and corruption.
  40. 40.
    Shen Kangsheng, “Historical Development of the Chinese Remainder Theorem”, Archive for History of Exact Sciences 38(4) (1988), 285–305.
    “At its very beginning there is the General Dayan qiuyi Rule, discussing extensively congruences of first degree”
    Used for: the treatise (Shu shu jiu zhang, 1247) opening with the general dayan qiuyi rule.
  41. 41.
    Shen Kangsheng, “Historical Development of the Chinese Remainder Theorem”, Archive for History of Exact Sciences 38(4) (1988), 285–305.
    “Qin summed up the Dayan qiuyi Rule (Rule of finding unity) in this connection.”
    Used for: Shen’s translation, “rule of finding unity”.
  42. 42.
    J. J. O’Connor and E. F. Robertson, “Qin Jiushao”, MacTutor History of Mathematics Archive, University of St Andrews (last update December 2003).
    “Chapter 1 is on indeterminate analysis; it contains remarkable work on the Chinese remainder theorem which occurs right at the beginning of the text.”
    Used for: the remainder problem at the very beginning of Qin’s treatise (second source).
  43. 43.
    J. J. O’Connor and E. F. Robertson, “Qin Jiushao”, MacTutor History of Mathematics Archive, University of St Andrews (last update December 2003).
    “Although there is no evidence of progress on such problems in China since the work of Sun Zi which was 800 years earlier, Qin now shows how to handle the case where the”
    Used for: Qin handling group sizes that share a common measure (MacTutor goes on: “are not pairwise coprime”).
  44. 44.
    Ho Peng-Yoke, “Ch’in Chiu-shao”, Complete Dictionary of Scientific Biography (Charles Scribner’s Sons; copy at the MacTutor archive) (2008).
    “The Shu-shu chiu-chang also deals with numbers which have common factors among them”
    Used for: Qin’s treatise dealing with group sizes that have common factors (second source).
  45. 45.
    J. J. O’Connor and E. F. Robertson, “Qin Jiushao”, MacTutor History of Mathematics Archive, University of St Andrews (last update December 2003).
    “Interestingly, despite Qin's character, he does not claim this brilliant method as his own. He says that he learn it from the calendar experts when he was studying at the Board of Astronomy in Hang-chou.”
    Used for: Qin not claiming the method as his own, and saying he learned it from the calendar experts (“learn” as printed).
  46. 46.
    J. J. O’Connor and E. F. Robertson, “Qin Jiushao”, MacTutor History of Mathematics Archive, University of St Andrews (last update December 2003).
    “He states, however, that these calendar experts used the rule without understanding it.”
    Used for: Qin’s statement that the calendar experts, from whom he learned the rule, used it without understanding it.
  47. 47.
    Shen Kangsheng, “Historical Development of the Chinese Remainder Theorem”, Archive for History of Exact Sciences 38(4) (1988), 285–305.
    “(Continuation of ancient mathematics for elucidating the strange, 1275) had four similar problems, three of which concerned n = 3 and the fourth n = 4”
    Used for: Yang Hui’s four problems of 1275 in imitation of Sun Zi’s (Shen: “Indeed, in imitation of the theorem, Yang Hui in Xu gu zhai qi suanfa …”), the fourth with four countings, in twos, fives, sevens and nines (the formula that follows).
  48. 48.
    Ho Peng-Yoke, “Yang Hui”, Complete Dictionary of Scientific Biography (Charles Scribner’s Sons; copy at the MacTutor archive) (2008).
    “Yang Hui also gives the common names used in his time, such as Ch’in Wang an tien ping (“the Prince of Ch’in’s secret method of counting soldiers”), chien kuan shu “method of cutting lengths of tube””
    Used for: the popular names recorded by Yang Hui.
  49. 49.
    Shen Kangsheng, “Historical Development of the Chinese Remainder Theorem”, Archive for History of Exact Sciences 38(4) (1988), 285–305.
    “Substituting these in formula (3) he got the final answer”
    Used for: Yang Hui’s answer to the four-counting problem, 157, in the formula that follows: x ≡ 315×1 + 126×2 + 540×3 + 280×4 ≡ 3307 ≡ 157 (mod 630).
  50. 50.
    Shen Kangsheng, “Historical Development of the Chinese Remainder Theorem”, Archive for History of Exact Sciences 38(4) (1988), 285–305.
    “work (c. 1000 A.D.) there is a remainder problem”
    Used for: a remainder problem in the work of Ibn al-Haytham, about 1000 (Shen: “In the Islamic scholar Ibn al-Haitham’s work …”).
  51. 51.
    Shen Kangsheng, “Historical Development of the Chinese Remainder Theorem”, Archive for History of Exact Sciences 38(4) (1988), 285–305.
    “did not give the slightest theoretical or general explanation of the method for solution of the remainder problem”
    Used for: remainder problems in Fibonacci’s Liber Abaci (1202), without any general explanation (Shen: “There are several remainder problems in Leonardo Fibonacci’s Liber Abaci (1202). However, Fibonacci did not give …”).
  52. 52.
    Ho Peng-Yoke, “Ch’in Chiu-shao”, Complete Dictionary of Scientific Biography (Charles Scribner’s Sons; copy at the MacTutor archive) (2008).
    “The rule is given in a German manuscript from Göttingen (ca. 1550)”
    Used for: the rule in a German manuscript from Göttingen, about 1550.
  53. 53.
    Shen Kangsheng, “Historical Development of the Chinese Remainder Theorem”, Archive for History of Exact Sciences 38(4) (1988), 285–305.
    “In the 18th century the great mathematicians L. Euler (1707–1783), J. L. Lagrange (1736–1813), and C. F. Gauss (1777–1855) studied successively the remainder problems and they accomplished ample achievements.”
    Used for: Euler, Lagrange and Gauss taking up remainder problems in turn.
  54. 54.
    David M. Burton, The History of Mathematics: An Introduction (7th ed., McGraw-Hill, 2011).
    Chapter 10, “The Revival of Number Theory: Fermat, Euler, and Gauss”, section 10.3, “The Prince of Mathematicians: Carl Friedrich Gauss”, “Gauss’s Disquisitiones Arithmeticae”, p. 547 (the whole topic: pp. 546–551).
    “Later, in the impressive Disquisitiones Arithmeticae of 1801”
    Used for: Gauss’s Disquisitiones Arithmeticae of 1801.
  55. 55.
    Ho Peng-Yoke, “Ch’in Chiu-shao”, Complete Dictionary of Scientific Biography (Charles Scribner’s Sons; copy at the MacTutor archive) (2008).
    “The idntity of the Chinese rule with Gauss’s formula has also been pointed out by Matthiessen in the last century, after chi’in’s study of indeterminate analysis was first brought to the attntion of the west by Alexander Wylie.”
    Used for: Wylie bringing Qin’s rule to the West, and Matthiessen pointing out that it agrees with Gauss’s formula (the misprints “idntity” and “attntion” are in the copy).
  56. 56.
    David M. Burton, Elementary Number Theory (7th ed., McGraw-Hill, 2011).
    Chapter 4, “The Theory of Congruences”, section 4.4, “Linear Congruences and the Chinese Remainder Theorem”, p. 79 (the whole topic: pp. 79–80).
    “In honor of their early contributions, the rule for obtaining a solution usually goes by the name of the Chinese Remainder Theorem.”
    Used for: the name given in honor of the early Chinese work.
  57. 57.
    David M. Burton, The History of Mathematics: An Introduction (7th ed., McGraw-Hill, 2011).
    Chapter 5, “The Twilight of Greek Mathematics: Diophantus”, section 5.3, “Diophantine Equations in Greece, India, and China”, “The Chinese Hundred Fowls Problem”, p. 230 (the whole topic: pp. 228–230).
    “Sun-Tsu seems not to have been aware that there were an infinite number of solutions to this indeterminate problem, for N = 23 is the only value he gave.”
    Used for: Sun Zi giving only the answer 23.