What does Hexagram and Star-Palace Mathematics conclude, in numbers, about “The Placement Rules of Zi Wei Dou Shu Are Maps Modulo 12”?

Answer: Chapter 5 writes the Life palace, the element bureau and the Zi Wei placement verse as piecewise affine maps modulo 12: Tian Fu is the reflection of Zi Wei across the Yin-Shen axis, and the fourteen main stars have only 12 layouts.

Scope of the numbers: Marked boxes separate published evidence, runnable Python calculations (16 programs), classical sources and the author's hypotheses.

中文版

Data table

The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it. printed values that match the answer: 12

   Life palace over 144 month-hour pairs: each branch [12] times
   example month 3, hour Chen: Life in Zi, Body in Shen
   Life Zi, Spouse Xu, Wealth Shen, Travel Wu, Career Chen, Fortune Yin
   opposite (Travel) = L + 6; Wealth = L - 4 = L + 8; Career = L - 8 = L + 4
   bureau by year stem (Jia/Ji .. Wu/Gui) and Life branch:
   stem 0  2 2 6 6 3 3 5 5 4 4 6 6
   stem 1  6 6 5 5 4 4 3 3 2 2 5 5
   stem 2  5 5 3 3 2 2 4 4 6 6 3 3
   stem 3  3 3 4 4 6 6 2 2 5 5 4 4
   stem 4  4 4 2 2 5 5 6 6 3 3 2 2
   bureau counts over the 60 cells: 2: 12, 3: 12, 4: 12, 5: 12, 6: 12
Reading: the Life and Body palaces are affine maps mod 12 of
month and hour, each branch equally often. The bureau is a table
look-up (the na yin cycle of the sixty stem-branch pairs); each
year stem gives its own pattern, and over the 60 cells each of
the five bureaus occurs exactly 12 times.

Key formula

\[L = (2 + (m-1) - h) \bmod 12, \qquad B = (2 + (m-1) + h) \bmod 12 .\]
Show the full program
# Chapter 5. Zi Wei Dou Shu: the Life Palace and the "element bureau".
# Branches are numbered 0..11 (Zi, Chou, Yin, ... Hai); stems 0..9 (Jia ..
# Gui). Birth month m (1..12, lunar) and birth hour h (0 = Zi .. 11 = Hai).
#   Life palace   start at Yin (2) as month 1, count forward to month m,
#                 then backward to hour h:   L = (2 + (m - 1) - h) mod 12
#   Body palace   forward instead:           (2 + (m - 1) + h) mod 12
#   12 palaces    Life, Siblings, Spouse, Children, Wealth, Health,
#                 Travel, Friends, Career, Property, Fortune, Parents at
#                 L, L - 1, ..., L - 11 (counted backward)
#   palace stems  the stem on Yin is 2 (year stem mod 5) + 2 (mod 10) - the
#                 "five tigers" rule of Book 37 - and stems run on from Yin
#   bureau        the na yin element of the Life palace's stem-branch pair
#                 gives the bureau: water 2, wood 3, metal 4, earth 5, fire 6
BRANCH = "Zi Chou Yin Mao Chen Si Wu Wei Shen You Xu Hai".split()
PALACES = ("Life Siblings Spouse Children Wealth Health Travel Friends "
           "Career Property Fortune Parents").split()
NAYIN = "metal fire wood earth metal fire water earth metal wood " \
        "water earth fire wood water".split() * 2   # 30 pairs of the 60
BUREAU = {"water": 2, "wood": 3, "metal": 4, "earth": 5, "fire": 6}

def life(m, h):
    return (2 + (m - 1) - h) % 12

def body(m, h):
    return (2 + (m - 1) + h) % 12

def stem_of(branch, year_stem):
    yin_stem = (2 * (year_stem % 5) + 2) % 10
    return (yin_stem + (branch - 2) % 12) % 10

def sexagenary(stem, branch):
    for k in range(60):
        if k % 10 == stem and k % 12 == branch:
            return k
    raise ValueError("stem and branch of different parity")

def bureau(year_stem, life_branch):
    k = sexagenary(stem_of(life_branch, year_stem), life_branch)
    return BUREAU[NAYIN[k // 2]]

if __name__ == "__main__":
    counts = [0] * 12
    for m in range(1, 13):
        for h in range(12):
            counts[life(m, h)] += 1
    print("   Life palace over 144 month-hour pairs: each branch {} times"
          .format(sorted(set(counts))))
    m, h = 3, 4
    L = life(m, h)
    print("   example month 3, hour Chen: Life in {}, Body in {}".format(
        BRANCH[L], BRANCH[body(m, h)]))
    print("   " + ", ".join("{} {}".format(PALACES[i], BRANCH[(L - i) % 12])
                          for i in range(0, 12, 2)))
    print("   opposite (Travel) = L + 6; Wealth = L - 4 = L + 8;"
          " Career = L - 8 = L + 4")
    tally = {}
    print("\n   bureau by year stem (Jia/Ji .. Wu/Gui) and Life branch:")
    for ys in range(5):
        row = [bureau(ys, b) for b in range(12)]
        for v in row:
            tally[v] = tally.get(v, 0) + 1
        print("   stem {}  ".format(ys) + " ".join(str(v) for v in row))
    print("   bureau counts over the 60 cells: " + ", ".join(
        "{}: {}".format(k, tally[k]) for k in sorted(tally)))
    print("\nReading: the Life and Body palaces are affine maps mod 12 of")
    print("month and hour, each branch equally often. The bureau is a table")
    print("look-up (the na yin cycle of the sixty stem-branch pairs); each")
    print("year stem gives its own pattern, and over the 60 cells each of")
    print("the five bureaus occurs exactly 12 times.")

Single source and citation

Fan, Y. (2026). Six-Dimensional Hypercube Walks, Hexagram Mutation Markov Chains and Modular Star-Palace Lattices (Version 1.0.0), Chapter 5: The Placement Rules of Zi Wei Dou Shu Are Maps Modulo 12. 5D Library. https://doi.org/10.5281/zenodo.24090176

DOI: 10.5281/zenodo.24090176 · Read the monograph · 5DL-B-064 · v1.0.0 · CC-BY-NC-ND-4.0

BibTeX
@book{fan2026064,
  author    = {Fan, Yafu},
  title     = {Six-Dimensional Hypercube Walks, Hexagram Mutation Markov Chains and Modular Star-Palace Lattices},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  doi       = {10.5281/zenodo.24090176},
  url       = {https://doi.org/10.5281/zenodo.24090176}
}

Other chapter answers in this book