《孫子算經卷下》 "Sun Tzŭ's Computational Classic: Volume III"
§36. Determining the sex of an unborn baby

And now for something completely different: this final section gives a numerological algorithm which allegedly determines the sex of an unborn baby.

It is quite a shame that three volumes of serious mathematical text should conclude thus.

Translation

Chinese source text: Version A, Version B, Version C, Version D.
Unless noted otherwise, I follow the text from Version D, 《知不足齋叢書》本.

Source text Target text Notes
今有孕婦、行年二十九難九月。未知所生。 Suppose there be [a] pregnant woman, [her] current years twenty-nine, [with] difficulty nine months. Know [we] not yet that [she shall] bear?
  • 行年: current years; lit. moving years
  • 難九月: difficulty nine months; or difficulty [in the] ninth month

    There is ambiguity here in whether "nine" is:

    1. a count (the woman gives birth after being pregnant for nine months);
    2. an ordinal relative to conception (the woman gives birth in the ninth month of her pregnancy); or
    3. an ordinal relative to the new year (the woman gives birth in the ninth month of the Chinese calendar).
答曰、生男。 Answer saith: [she shall] bear [a] male.
術曰、置四十九、加難月、減行年 Method saith: put [down] forty-nine, add [the] months of difficulty, [and] subtract [her] current years.
  • 難月: months of difficulty; or month of difficulty
  • For the given inputs, we get
    49 + \colr{9} - \colv{29} = 29.
所餘、以天除一、地除二、人除三、四時除四、五行除五、六律除六、七星除七、八風除八、九州除九。 [Of] that which remaineth: with Heaven remove one, Earth remove two, Man remove three, [the] Four Seasons remove four, [the] Five Elements remove five, [the] Six Pitches remove six, [the] Seven Stars remove seven, [the] Eight Winds remove eight, [and the] Nine Provinces remove nine.
  • We compute
    29 - 1 - 2 - 3 - 4 - 5 - 6 - 7 = 1,
    where we have stopped before 8 to avoid the result becoming non-positive.
其不盡者、奇則為男、耦則為女。 [The] remainder thereof, odd be [it a] male, [and] even be [it a] female.
  • Since the remainder 1 is odd, it's a boy. Which is to be expected, for a text with patriarchal authorship.

Extended commentary

Ambiguity

We saw the ambiguity that exists with 難九月, which can be interpreted countwise ("difficulty nine months") or ordinally ("difficulty [in the] ninth month").

I have been able to find another text that gives this sex-determination algorithm, but which introduces yet more ambiguity by possibly referring to the month of conception rather than the duration of pregnancy. The following extract is from 《古今圖書集成》, "Olden [and] Current Diagrammed Books Collection", the Chinese text from ctext.org Library, with olden-style punctuation added by me:

Source text Target text Notes
〈孕推男女法〉 '[The] Method of Pregnant Deduction of Male [or] Female'
歌、
四十九數加孕月
行年歲定無疑。
一除至九多餘數、
逢雙是女隻生兒。
[The] song [saith]:
Forty-nine [the] number plus [the] months of pregnancy,
Subtracting of [it her] current years [is it] definitely without doubt.
One removed unto nine, [the] number of excess,
Encountering [a] double is [it] a daughter, [a] single [she] beareth [a] son.
  • 孕月: months of pregnancy; or month of pregnancy

    This is even more ambiguous than the text in Sun Tzŭ's Computational Classic, as "month of pregnancy" could arguably mean the month of conception.

今有孕婦、行年二十八歲八月有孕。問所生男女。 Suppose there be [a] pregnant woman, [her] current years twenty-eight years, eighth months being pregnant. [We] ask, [is] that [she shall] bear male [or] female?
  • 八月有孕: eighth months being pregnant; or [in the] eighth month become pregnant

    I think both renderings are defensible:

    • the first because of the phrase 十月懷胎, in which 十月 is the duration "ten months" (not "[in the] tenth month"), and
    • the second because , at least to my ears, has the connotation of becoming pregnant.
答曰、生男。 Answer saith: [she shall] bear [a] male.
法曰、置四十九、加孕月八、共五十七、減年二十八、餘二十九。 Method saith: put [down] forty-nine, [and] add [the] months of pregnancy eight, altogether fifty-seven, [and] subtract [her] years twenty-eight, remainder twenty-nine.
  • 孕月: months of pregnancy; or month of pregnancy
減天除一、地除二、人除三、四時除四、五行除五、六律除六、七星除七、不盡、奇為男、偶為女也。 Subtracting Heaven removing one, Earth removing two, Man removing three, [the] Four Seasons removing four, [the] Five Elements removing five, [the] Six Pitches removing six, [and the] Seven Stars removing seven, [there be a] remainder: odd be [it a] male, [and] even be [it a] female.
(一三五七九者、奇、二四六八十、皆偶。) (One, three, five, seven, [and] nine, [are] odd; two, four, six, eight, [and] ten, all even.)
如數多、再以八風除八。 If [the] number [be yet] more, furthermore with [the] Eight Winds remove eight.

Lookup table

Suppose for a moment that we ignore the mechanism which determines sex in humans, along with any real-world exceptions to a single baby of definite sex (such as boy-girl twins, chromosomal syndromes, etc.). Let us also ignore the fact that there are too many women of the same age in existence, who, after a full term, will give birth within the same month, for this numerological algorithm to work (because statistics). Then what?

Well, if you can…

  1. Decide on whether the algorithm's "years" should be
    1. the age of mum-to-be in solar years, or
    2. the age of mum-to-be according to East Asian age reckoning,
    and whether it should be
    1. her age at the time of conception, or
    2. her age at the time of baby's birth;
  2. Decide on whether the algorithm's "month" or "months" should be
    1. the gestation period in lunar months,
    2. the Chinese calendar month of conception, or
    3. the Chinese calendar month of baby's birth;
    and
  3. Decide on whether to observe modern time zones or local solar time (if using the Chinese calendar in any of the earlier steps);

… then you are ready to consult the table below. In each cell:

Note that when mum-to-be is in her fifties or higher, the algorithm starts to break because 49 + \text{months} - \text{years} is already non-positive (cells containing a question mark). Which is just as well, since median menopausal age is around fifty years.

Years Month or Months
1 2 3 4 5 6 7 8 9 10 11 12
16 (−7)
6
F
(−7)
7
M
(−7)
8
F
(−8)
1
M
(−8)
2
F
(−8)
3
M
(−8)
4
F
(−8)
5
M
(−8)
6
F
(−8)
7
M
(−8)
8
F
(−8)
9
M
17 (−7)
5
M
(−7)
6
F
(−7)
7
M
(−7)
8
F
(−8)
1
M
(−8)
2
F
(−8)
3
M
(−8)
4
F
(−8)
5
M
(−8)
6
F
(−8)
7
M
(−8)
8
F
18 (−7)
4
F
(−7)
5
M
(−7)
6
F
(−7)
7
M
(−7)
8
F
(−8)
1
M
(−8)
2
F
(−8)
3
M
(−8)
4
F
(−8)
5
M
(−8)
6
F
(−8)
7
M
19 (−7)
3
M
(−7)
4
F
(−7)
5
M
(−7)
6
F
(−7)
7
M
(−7)
8
F
(−8)
1
M
(−8)
2
F
(−8)
3
M
(−8)
4
F
(−8)
5
M
(−8)
6
F
20 (−7)
2
F
(−7)
3
M
(−7)
4
F
(−7)
5
M
(−7)
6
F
(−7)
7
M
(−7)
8
F
(−8)
1
M
(−8)
2
F
(−8)
3
M
(−8)
4
F
(−8)
5
M
21 (−7)
1
M
(−7)
2
F
(−7)
3
M
(−7)
4
F
(−7)
5
M
(−7)
6
F
(−7)
7
M
(−7)
8
F
(−8)
1
M
(−8)
2
F
(−8)
3
M
(−8)
4
F
22 (−6)
7
M
(−7)
1
M
(−7)
2
F
(−7)
3
M
(−7)
4
F
(−7)
5
M
(−7)
6
F
(−7)
7
M
(−7)
8
F
(−8)
1
M
(−8)
2
F
(−8)
3
M
23 (−6)
6
F
(−6)
7
M
(−7)
1
M
(−7)
2
F
(−7)
3
M
(−7)
4
F
(−7)
5
M
(−7)
6
F
(−7)
7
M
(−7)
8
F
(−8)
1
M
(−8)
2
F
24 (−6)
5
M
(−6)
6
F
(−6)
7
M
(−7)
1
M
(−7)
2
F
(−7)
3
M
(−7)
4
F
(−7)
5
M
(−7)
6
F
(−7)
7
M
(−7)
8
F
(−8)
1
M
25 (−6)
4
F
(−6)
5
M
(−6)
6
F
(−6)
7
M
(−7)
1
M
(−7)
2
F
(−7)
3
M
(−7)
4
F
(−7)
5
M
(−7)
6
F
(−7)
7
M
(−7)
8
F
26 (−6)
3
M
(−6)
4
F
(−6)
5
M
(−6)
6
F
(−6)
7
M
(−7)
1
M
(−7)
2
F
(−7)
3
M
(−7)
4
F
(−7)
5
M
(−7)
6
F
(−7)
7
M
27 (−6)
2
F
(−6)
3
M
(−6)
4
F
(−6)
5
M
(−6)
6
F
(−6)
7
M
(−7)
1
M
(−7)
2
F
(−7)
3
M
(−7)
4
F
(−7)
5
M
(−7)
6
F
28 (−6)
1
M
(−6)
2
F
(−6)
3
M
(−6)
4
F
(−6)
5
M
(−6)
6
F
(−6)
7
M
(−7)
1
M
(−7)
2
F
(−7)
3
M
(−7)
4
F
(−7)
5
M
29 (−5)
6
F
(−6)
1
M
(−6)
2
F
(−6)
3
M
(−6)
4
F
(−6)
5
M
(−6)
6
F
(−6)
7
M
(−7)
1
M
(−7)
2
F
(−7)
3
M
(−7)
4
F
30 (−5)
5
M
(−5)
6
F
(−6)
1
M
(−6)
2
F
(−6)
3
M
(−6)
4
F
(−6)
5
M
(−6)
6
F
(−6)
7
M
(−7)
1
M
(−7)
2
F
(−7)
3
M
31 (−5)
4
F
(−5)
5
M
(−5)
6
F
(−6)
1
M
(−6)
2
F
(−6)
3
M
(−6)
4
F
(−6)
5
M
(−6)
6
F
(−6)
7
M
(−7)
1
M
(−7)
2
F
32 (−5)
3
M
(−5)
4
F
(−5)
5
M
(−5)
6
F
(−6)
1
M
(−6)
2
F
(−6)
3
M
(−6)
4
F
(−6)
5
M
(−6)
6
F
(−6)
7
M
(−7)
1
M
33 (−5)
2
F
(−5)
3
M
(−5)
4
F
(−5)
5
M
(−5)
6
F
(−6)
1
M
(−6)
2
F
(−6)
3
M
(−6)
4
F
(−6)
5
M
(−6)
6
F
(−6)
7
M
34 (−5)
1
M
(−5)
2
F
(−5)
3
M
(−5)
4
F
(−5)
5
M
(−5)
6
F
(−6)
1
M
(−6)
2
F
(−6)
3
M
(−6)
4
F
(−6)
5
M
(−6)
6
F
35 (−4)
5
M
(−5)
1
M
(−5)
2
F
(−5)
3
M
(−5)
4
F
(−5)
5
M
(−5)
6
F
(−6)
1
M
(−6)
2
F
(−6)
3
M
(−6)
4
F
(−6)
5
M
36 (−4)
4
F
(−4)
5
M
(−5)
1
M
(−5)
2
F
(−5)
3
M
(−5)
4
F
(−5)
5
M
(−5)
6
F
(−6)
1
M
(−6)
2
F
(−6)
3
M
(−6)
4
F
37 (−4)
3
M
(−4)
4
F
(−4)
5
M
(−5)
1
M
(−5)
2
F
(−5)
3
M
(−5)
4
F
(−5)
5
M
(−5)
6
F
(−6)
1
M
(−6)
2
F
(−6)
3
M
38 (−4)
2
F
(−4)
3
M
(−4)
4
F
(−4)
5
M
(−5)
1
M
(−5)
2
F
(−5)
3
M
(−5)
4
F
(−5)
5
M
(−5)
6
F
(−6)
1
M
(−6)
2
F
39 (−4)
1
M
(−4)
2
F
(−4)
3
M
(−4)
4
F
(−4)
5
M
(−5)
1
M
(−5)
2
F
(−5)
3
M
(−5)
4
F
(−5)
5
M
(−5)
6
F
(−6)
1
M
40 (−3)
4
F
(−4)
1
M
(−4)
2
F
(−4)
3
M
(−4)
4
F
(−4)
5
M
(−5)
1
M
(−5)
2
F
(−5)
3
M
(−5)
4
F
(−5)
5
M
(−5)
6
F
41 (−3)
3
M
(−3)
4
F
(−4)
1
M
(−4)
2
F
(−4)
3
M
(−4)
4
F
(−4)
5
M
(−5)
1
M
(−5)
2
F
(−5)
3
M
(−5)
4
F
(−5)
5
M
42 (−3)
2
F
(−3)
3
M
(−3)
4
F
(−4)
1
M
(−4)
2
F
(−4)
3
M
(−4)
4
F
(−4)
5
M
(−5)
1
M
(−5)
2
F
(−5)
3
M
(−5)
4
F
43 (−3)
1
M
(−3)
2
F
(−3)
3
M
(−3)
4
F
(−4)
1
M
(−4)
2
F
(−4)
3
M
(−4)
4
F
(−4)
5
M
(−5)
1
M
(−5)
2
F
(−5)
3
M
44 (−2)
3
M
(−3)
1
M
(−3)
2
F
(−3)
3
M
(−3)
4
F
(−4)
1
M
(−4)
2
F
(−4)
3
M
(−4)
4
F
(−4)
5
M
(−5)
1
M
(−5)
2
F
45 (−2)
2
F
(−2)
3
M
(−3)
1
M
(−3)
2
F
(−3)
3
M
(−3)
4
F
(−4)
1
M
(−4)
2
F
(−4)
3
M
(−4)
4
F
(−4)
5
M
(−5)
1
M
46 (−2)
1
M
(−2)
2
F
(−2)
3
M
(−3)
1
M
(−3)
2
F
(−3)
3
M
(−3)
4
F
(−4)
1
M
(−4)
2
F
(−4)
3
M
(−4)
4
F
(−4)
5
M
47 (−1)
2
F
(−2)
1
M
(−2)
2
F
(−2)
3
M
(−3)
1
M
(−3)
2
F
(−3)
3
M
(−3)
4
F
(−4)
1
M
(−4)
2
F
(−4)
3
M
(−4)
4
F
48 (−1)
1
M
(−1)
2
F
(−2)
1
M
(−2)
2
F
(−2)
3
M
(−3)
1
M
(−3)
2
F
(−3)
3
M
(−3)
4
F
(−4)
1
M
(−4)
2
F
(−4)
3
M
49 (−0)
1
M
(−1)
1
M
(−1)
2
F
(−2)
1
M
(−2)
2
F
(−2)
3
M
(−3)
1
M
(−3)
2
F
(−3)
3
M
(−3)
4
F
(−4)
1
M
(−4)
2
F
50 ? (−0)
1
M
(−1)
1
M
(−1)
2
F
(−2)
1
M
(−2)
2
F
(−2)
3
M
(−3)
1
M
(−3)
2
F
(−3)
3
M
(−3)
4
F
(−4)
1
M
51 ? ? (−0)
1
M
(−1)
1
M
(−1)
2
F
(−2)
1
M
(−2)
2
F
(−2)
3
M
(−3)
1
M
(−3)
2
F
(−3)
3
M
(−3)
4
F
52 ? ? ? (−0)
1
M
(−1)
1
M
(−1)
2
F
(−2)
1
M
(−2)
2
F
(−2)
3
M
(−3)
1
M
(−3)
2
F
(−3)
3
M
53 ? ? ? ? (−0)
1
M
(−1)
1
M
(−1)
2
F
(−2)
1
M
(−2)
2
F
(−2)
3
M
(−3)
1
M
(−3)
2
F
54 ? ? ? ? ? (−0)
1
M
(−1)
1
M
(−1)
2
F
(−2)
1
M
(−2)
2
F
(−2)
3
M
(−3)
1
M
55 ? ? ? ? ? ? (−0)
1
M
(−1)
1
M
(−1)
2
F
(−2)
1
M
(−2)
2
F
(−2)
3
M
56 ? ? ? ? ? ? ? (−0)
1
M
(−1)
1
M
(−1)
2
F
(−2)
1
M
(−2)
2
F
57 ? ? ? ? ? ? ? ? (−0)
1
M
(−1)
1
M
(−1)
2
F
(−2)
1
M
58 ? ? ? ? ? ? ? ? ? (−0)
1
M
(−1)
1
M
(−1)
2
F
59 ? ? ? ? ? ? ? ? ? ? (−0)
1
M
(−1)
1
M
60 ? ? ? ? ? ? ? ? ? ? ? (−0)
1
M
61 ? ? ? ? ? ? ? ? ? ? ? ?
END of Volume III

Cite this page

Conway (2023). "Sun Tzŭ's Computational Classic: Volume III §36". <https://yawnoc.github.io/sun-tzu/iii/36> Accessed yyyy-mm-dd.