DEV Community

David Webb
David Webb

Posted on

I found a 60-step cycle in a 2,000-year-old calendar

Title: I found a 60-step cycle in a 2,000-year-old calendar

While parsing a sexagenary calendar record, I kept getting hung up on two counters: one wraps at 10, the other at 12, and both advance together. Their least common multiple is 60, so the pair repeats as a 60-step state machine. No fractional adjustments needed.

That fixed sequence indexes cyclical time markers across days, months, and years. I wrote it as a discrete modulo generator using integer arithmetic alone. It shows how ancient astronomers maintained a continuous, drift-free epoch reference for more than two millennia.

When I first started looking at BaZi, or Four Pillars records, I expected paragraphs of free-form symbolic prose. Instead, I found a compact record of four paired labels: year, month, day, and hour. Each pillar consists of one stem-branch pair drawn from two repeating counters. There are 10 Heavenly Stems and 12 Earthly Branches. If every stem could pair with every branch independently, you would get 120 combinations. But the traditional algorithm steps both lists simultaneously. Starting from Jia-Zi, the sequence proceeds to Yi-Chou, then Bing-Yin, and so on. Because both counters step in tandem, only 60 distinct pairings occur before the system returns to Jia-Zi.

In code, this periodic state can be represented with a single integer scalar n. The stem index is evaluated as n mod 10, and the branch index as n mod 12. Incrementing n by 1 advances to the next paired symbol, while incrementing n by 60 returns the system to its starting pair. It operates like two clocks with different period lengths sharing a single step counter.

This shared encoding makes cycle positions directly comparable across time scales, but those four pillars are not one giant clock ticking at a uniform speed. Each unit uses its own rules to find its current index. A day is divided by the hour branch into 12 two-hour intervals, such as Zi around 11 p.m. to 1 a.m. The hour stem is not an isolated counter looked up from clock time alone; its assignment is linked directly to the day stem.

Beyond the initial birth chart, the system extends into longer ten-year phases derived from the month pillar. These decade pillars advance through the stem-branch sequence every ten years. This invites a state-machine analogy where the birth chart acts as the initial state, the decade pillar changes at a calculated boundary, and current calendar cycles provide additional inputs. However, this state machine only tells us how labels transition under defined rules; it does not establish physical causation.

I am still unsure about which time-normalization convention is most faithful to historical practice: civil clock time, local mean solar time, or apparent solar time. What stands out to me as a data engineer is the structural elegance. Integer arithmetic alone maintains a periodic index without requiring floating-point adjustments.

Not medical, legal, or financial advice. A cultural and cognitive framework for self-reflection; outputs vary by individual.

Top comments (0)