Code Library for the Sexagenary Cycle
by Maxwell Joslyn. .
https://en.wikipedia.org/wiki/Sexagenary_cycle
Code for converting between Gregorian and Chinese year numbers already exists. Wikipedia highlights the current year on the sexegenary cycle list, and somebody programmed that. But, all the same, I can amuse myself by thinking about it.
Things to be defined would include:
- the Ten Stems and the Twelve Branches
- the 60-element cycle formed from pairing Stems and Branches by the traditional method
- the 60-element "false cycle"1, formed by all the pairs not in the traditional cycle
- given a number indicating 1 thru 60 as the starting year, and a number +/-N, return the Stem and Branch for the year N years after/before the starting year
- given a Gregorian year, return its Stem and Branch according to the traditional calendar
- given a Stem and Branch, return the most recent Gregorian year, or all of them (up to an optional stopping point), which were that Stem and Branch on the traditional calendar
-
The "false cycle" is my made-up, provisional name. There's probably a real one.↩