5D Library › Almanac Auspicious Boolean Lattices, Jianchu Twelve-Officer Congruences and Runic Combinatorics · 中文

Chapter 2. The Twelve Officers as a Piecewise Congruence, and Which Day Is the Jie Day

A congruence that skips a beat twelve times a year

The twelve officers (jian, chu, man, ping, ding, zhi, po, wei, cheng, shou, kai, bi) are a simple congruence. Let b(t)b(t) be the branch of day tt (0 to 11) and M(t)M(t) the branch of its solar month, which starts with the yin month at Lichun and advances by one at each jie. Then the officer is

o(t)≡b(t)−M(t)(mod⁡12).o(t) \equiv b(t) – M(t) \pmod{12}.

The day branch advances by one every day; the month branch advances by one at each jie; so on a jie day the two steps cancel and the officer repeats the previous day’s. The Japanese almanac tradition calls this repetition “dancing” (odoru), and a dancing officer marks the day of a jie (国立天文台 2026). The officer of a day is therefore a piecewise affine function of tt with twelve breaks a year.

Calculation

# Chapter 2. p03: The twelve officers as a piecewise congruence.
# officer = (day branch - month branch) mod 12. The day branch advances
# by 1 every day; the month branch advances by 1 at each "jie", so on a
# jie day the officer repeats the previous day's. Listed: the 12 repeat
# days of 2027 (Beijing time), and how often each officer occurs.
import datetime

OFFICERS = ("jian chu man ping ding zhi po wei cheng shou kai bi").split()
# the 12 "jie" of 2027, Beijing time (UTC+8), from NAOJ's 2027 table
JIE = ((1, 5, 22, 10), (2, 4, 9, 46), (3, 6, 3, 40), (4, 5, 8, 17),
       (5, 6, 1, 25), (6, 6, 5, 26), (7, 7, 15, 37), (8, 8, 1, 27),
       (9, 8, 4, 28), (10, 8, 20, 17), (11, 7, 23, 39), (12, 7, 16, 38))
D0 = datetime.date(2027, 1, 1)          # geng-chen day, mansion Gui (22)

def days(offset_h=0):
    """One dict per day of 2027: stem, branch, month and year branch."""
    jie = [datetime.datetime(2027, m, d, h, mi) +
           datetime.timedelta(hours=offset_h) for m, d, h, mi in JIE]
    out = []
    for k in range(365):
        day = D0 + datetime.timedelta(days=k)
        n = sum(1 for j in jie if j.date() <= day)   # jie passed
        gz = (16 + k) % 60
        out.append({"date": day, "gz": gz, "s": gz % 10, "b": gz % 12,
                    "M": n % 12, "Y": 6 if n < 2 else 7,
                    "mansion": (22 + k) % 28})
    return out

BR = "zi chou yin mao chen si wu wei shen you xu hai".split()

if __name__ == "__main__":
    ds = days()
    off = [(d["b"] - d["M"]) % 12 for d in ds]
    print("   repeat days of 2027 (officer, day branch, month branch):")
    reps = [k for k in range(1, 365) if off[k] == off[k - 1]]
    for k in reps:
        d = ds[k]
        print("     {}  {:6s} {:5s} month {}".format(
            d["date"].isoformat(), OFFICERS[off[k]], BR[d["b"]],
            BR[d["M"]]))
    cnt = [off.count(i) for i in range(12)]
    print("   repeats: {}; days per officer:".format(len(reps)))
    for h in (0, 6):
        print("     {}".format(" ".join("{}={}".format(OFFICERS[i], cnt[i])
                                        for i in range(h, h + 6))))
    naive = [(d["b"] - ds[0]["b"] + off[0]) % 12 for d in ds]
    wrong = sum(1 for x, y in zip(naive, off) if x != y)
    print("   a plain 12-day cycle with no repeats is wrong on {} of 365"
          " days".format(wrong))
#    repeat days of 2027 (officer, day branch, month branch):
#      2027-01-05  wei    shen  month chou
#      2027-02-04  jian   yin   month yin
#      2027-03-06  zhi    shen  month mao
#      2027-04-05  kai    yin   month chen
#      2027-05-06  ding   you   month si
#      2027-06-06  kai    chen  month wu
#      2027-07-07  ding   hai   month wei
#      2027-08-08  bi     wei   month shen
#      2027-09-08  zhi    yin   month you
#      2027-10-08  kai    shen  month xu
#      2027-11-07  ping   yin   month hai
#      2027-12-07  cheng  shen  month zi
#    repeats: 12; days per officer:
#      jian=30 chu=29 man=29 ping=30 ding=32 zhi=32
#      po=30 wei=31 cheng=31 shou=29 kai=32 bi=30
#    a plain 12-day cycle with no repeats is wrong on 336 of 365 days

In 2027 the twelve repeats fall on the jie days from 5 January to 7 December. Which officer repeats depends on the year: at Lichun (4 February 2027) it is jian, because that day is a yin day in the yin month, so 3 and 4 February are both jian. The repeats make the officers slightly uneven over a year: ding, zhi and kai occur on 32 days, chu, man and shou on 29. An almanac app that simply cycles the twelve names without repeats drifts by one place at each jie and is wrong on 336 of the 365 days.

Which day is the jie day?

The repeat falls on the local calendar date of the solar term. A term that falls near midnight therefore falls on different dates in different time zones, and an almanac computed for one place disagrees with one computed for another.

Calculation

# Chapter 2. p04: Which day is the jie day? The repeat falls on the
# local date of the solar term, so an almanac computed for another time
# zone can differ. Counted: days of 2027 whose officer differs from the
# Beijing (UTC+8) almanac when computed for UTC+9, UTC+7, UTC-5 and
# UTC-8. Also: a low-precision solar formula (Meeus, about 0.01 degree)
# against NAOJ's published times, and jie that fall within an hour of
# midnight in Beijing.
import math
import datetime

OFFICERS = ("jian chu man ping ding zhi po wei cheng shou kai bi").split()
# the 12 "jie" of 2027, Beijing time (UTC+8), from NAOJ's 2027 table
JIE = ((1, 5, 22, 10), (2, 4, 9, 46), (3, 6, 3, 40), (4, 5, 8, 17),
       (5, 6, 1, 25), (6, 6, 5, 26), (7, 7, 15, 37), (8, 8, 1, 27),
       (9, 8, 4, 28), (10, 8, 20, 17), (11, 7, 23, 39), (12, 7, 16, 38))
D0 = datetime.date(2027, 1, 1)          # geng-chen day, mansion Gui (22)

def days(offset_h=0):
    """One dict per day of 2027: stem, branch, month and year branch."""
    jie = [datetime.datetime(2027, m, d, h, mi) +
           datetime.timedelta(hours=offset_h) for m, d, h, mi in JIE]
    out = []
    for k in range(365):
        day = D0 + datetime.timedelta(days=k)
        n = sum(1 for j in jie if j.date() <= day)   # jie passed
        gz = (16 + k) % 60
        out.append({"date": day, "gz": gz, "s": gz % 10, "b": gz % 12,
                    "M": n % 12, "Y": 6 if n < 2 else 7,
                    "mansion": (22 + k) % 28})
    return out

LON = (285, 315, 345, 15, 45, 75, 105, 135, 165, 195, 225, 255)

def sun_lon(jde):
    T = (jde - 2451545.0) / 36525
    L0 = 280.46646 + 36000.76983 * T + 0.0003032 * T * T
    M = math.radians(357.52911 + 35999.05029 * T - 0.0001537 * T * T)
    C = ((1.914602 - 0.004817 * T - 0.000014 * T * T) * math.sin(M) +
         (0.019993 - 0.000101 * T) * math.sin(2 * M) +
         0.000289 * math.sin(3 * M))
    om = math.radians(125.04 - 1934.136 * T)
    return (L0 + C - 0.00569 - 0.00478 * math.sin(om)) % 360

def jie_formula(k):
    """Beijing time of the k-th jie of 2027 by the formula (Delta T 69 s)."""
    t0 = datetime.datetime(2027, JIE[k][0], JIE[k][1], 12)
    jd = 2461406.5 + (t0 - datetime.datetime(2027, 1, 1)).total_seconds() \
        / 86400 - 8 / 24
    for _ in range(40):
        jd += ((LON[k] - sun_lon(jd + 69 / 86400) + 180) % 360 - 180) \
            / 0.9856
    return datetime.datetime(2027, 1, 1) + datetime.timedelta(
        days=jd - 2461406.5 + 8 / 24)

if __name__ == "__main__":
    base = [(d["b"] - d["M"]) % 12 for d in days()]
    for name, off in (("UTC+9", 1), ("UTC+7", -1), ("UTC-5", -13),
                      ("UTC-8", -16)):
        o = [(d["b"] - d["M"]) % 12 for d in days(off)]
        diff = [days()[k]["date"].isoformat() for k in range(365)
                if o[k] != base[k]]
        word = "day differs" if len(diff) == 1 else "days differ"
        shown = ", ".join(diff[:3]) + (" ..." if len(diff) > 3 else "")
        print("   {}: {} {}{}".format(
            name, len(diff), word, (": " + shown) if diff else ""))
    err = []
    for k, (m, d, h, mi) in enumerate(JIE):
        pub = datetime.datetime(2027, m, d, h, mi)
        err.append((jie_formula(k) - pub).total_seconds() / 60)
    print("   formula minus NAOJ: {:.1f} to {:.1f} minutes".format(
        min(err), max(err)))
    for m, d, h, mi in JIE:
        if h == 23 or h == 0:
            print("   within an hour of midnight: 2027-{:02d}-{:02d} "
                  "{:02d}:{:02d} Beijing".format(m, d, h, mi))
#    UTC+9: 1 day differs: 2027-11-07
#    UTC+7: 0 days differ
#    UTC-5: 7 days differ: 2027-02-03, 2027-03-05, 2027-04-04 ...
#    UTC-8: 8 days differ: 2027-02-03, 2027-03-05, 2027-04-04 ...
#    formula minus NAOJ: -4.5 to -0.8 minutes
#    within an hour of midnight: 2027-11-07 23:39 Beijing

In 2027 the Lidong term falls at 23:39 Beijing time on 7 November, which is already 00:39 on 8 November in Tokyo. An almanac computed for UTC+9 therefore differs from the Beijing one on 1 day; one for UTC+7 on none. An almanac computed for New York (UTC-5) differs on 7 days and one for Los Angeles (UTC-8) on 8, because terms that fall in the Beijing morning fall on the previous evening there. The low-precision solar formula used for checking (Meeus 1998) gives the 2027 terms between 4.5 and 0.8 minutes earlier than the published times, which matters only for a term within minutes of midnight; Lidong 2027, at 21 minutes, is the closest.

The officer index over the first 60 days of 2027; the two repeats (jie days) are marked (p03).

Note

State the place. An almanac’s officers, month gods and month-based spirits are defined for a place and a time zone. Diaspora almanacs that reuse Beijing dates without saying so, and apps that compute in the phone’s local time without saying so, can both be “right” and still disagree.

Summary

The officer is b−M(mod⁡12)b – M \pmod{12}, a congruence that repeats at each of the twelve jie; in 2027 Lichun repeats jian. A plain cycle without repeats is wrong on 336 days. Because the repeat falls on the local date of the term, almanacs for Tokyo, New York or Los Angeles differ from the Beijing almanac on 1, 7 and 8 days of 2027.

References

Meeus, Jean. 1998. Astronomical Algorithms. 2nd ed. Willmann-Bell.
国立天文台. 2026. 暦Wiki:十二直. National Astronomical Observatory of Japan. https://eco.mtk.nao.ac.jp/koyomi/wiki/BDBDC6F3C4BE.html.

Fan, Y. (2026). Almanac Auspicious Boolean Lattices, Jianchu Twelve-Officer Congruences and Runic Combinatorics: Constraint Satisfaction Paradoxes, Solar-Term Phase Jumps and Elder Futhark Inversion Distributions [黄历择吉布尔格、建除十二直同余与卢恩符文组合学] (Version 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.24090239 · Licensed under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0).