Tiangan: A, B, C, D, E, Ji, G, Xin, Ren and Gui are collectively called "Ten Tiangan". They are divided into five Gan Yang and five Yin dry.
Earthly branches: Zi, Ugly, Yin, Mao, Chen, Si, Wu, Wei, Shen, You, Xu and Hai, collectively called "Twelve Earthly Branches", are divided into 6 Yang Branches and 6 Yin Branches.
A is the beginning of heavenly stem, the son is the beginning of earthly branch, heavenly stem is above, earthly branch is below, Jiazi is consistent, ugly is consistent, and the rest are consistent in turn, which is called "Jiazi". In ancient times, Jiazi was used to mark years, months and days.
There are dozens of heavenly stems, five of yin and yang, twelve of earthly branches, six of yin and yang, six of heavenly stems and five of earthly branches, so it is also called "Sixty Jiazi".
Periodic table:
Jia Chubing Yin Dingmao Wu Renshen Gui You
Jia Haibing Zi Ding Chou Mao Xin Si Ren Wu Guiwei
Shen Jia Yi Youbing Xu Ding Wu Haizi ugly Geng Yin Xin Mao Renchen ghost silk
Wu Jia translated Shen Dingyou, the Reform Movement of 1898, and Ji Haigeng rewarded Ren Yin Guimao.
Chen Jia, Bess, Bing Wuding, Wu Shen, Ji You, Geng Xu, Xin Hai, Ren Zi, Gui Chou.
Jia Yin, Yi Mao, Chen Bing, Ding Si, Wu Wu and Xin You have not applied for this position, and they have all failed.
Algorithm ideas:
The rule of Jiazi combination is that according to the original branch order, the five yang branches dominate the six yang branches, and the five yin branches are mainly six yin branches. Results Altogether, there were 60 branches (or Jiazi), and Jiazi was a week. Observing the above table, we can find that the heavenly stems and earthly branches combination goes down in turn, forming a cycle until the sky turns six times and the earth turns five times.
With the periodic table, it is much more convenient to use heavenly stems and earthly branches calendar year, calendar month and calendar day.
Annual trunk-branch extrapolation algorithm
China has long recorded the years with dead branches, which have been used ever since. Some people set the first year of Jiazi in 2696 BC. Compared with AD, the trunk of 4 years is the year of Jiazi in the lunar calendar. Therefore, we subtract 3 from the AD number and divide it by 60 (the number of sixty years), and use the ordinal table of sixty years to find out the trunk of that year. The formula is:
(years required -3)/60 = quotient. . . Remainder (annual branch ordinal)
If the remainder is equal to 0, add 60 to the stem ordinal.
For example, find the age of the trunk and branch in the lunar calendar 1983: (1983-3)/60 = 30. . . 0, then 0+60 = 60 (branch ordinal number), and the lookup table is the year of Guihai.
Monthly branch deduction algorithm:
When the dryness of a year is A or already, the dryness of the first month is C;
When the sky is B or G in 2008, the sky is E in the first month;
In 2008, when the sky was dry for C or Xin, it was dry for G in the first month;
In 2008, when Tiangan was appointed as Ding or Ren, Tiangan was appointed as Ren in the first month;
When the heavenly stems in 2008 are E or decyl, the heavenly stems in the first month are A. ..
First, calculate the heavenly stems in the first month of the lunar calendar, and other months can be analogized according to the sequence number of heavenly stems. The calculation method of the serial number of Tiangan in the first month of that year is: divide the remainder of that year by 5, subtract 2, multiply 2, and subtract 1. When the number is negative, add 10.
Example: Find the stem of the first month of A.D. 199 1 (Wesson's Year of the Lunar New Year): 199 1/5=398+0, and the serial number of the stem is (1-2) x 2-/kloc-0. February is Xin Mao, March is Ren Chen, and so on.
Daily relay push algorithm
Because there is no certain rule to follow in the size of the lunar month, it is impossible to calculate the date of the lunar calendar in a simple way. Therefore, a better way to calculate the lunar calendar date is to use the calendar.
Although the size of the lunar calendar is not fixed, and the lunar calendar has a leap month (February) every four years, the size of the month is fixed every year, so we can calculate the branches and branches of a day from the solar calendar, and the calculation formula is:
Daily dryness = (ordinal number of daily dryness on New Year's Day)+(required days)+(daily dryness of each month is increased or decreased, and1is added after March of leap year)/10.
= quotient ... remainder (daily ordinal)
Daily branch = (New Year's Day earthly branch ordinal number)+(days required)+(days added and subtracted in each month, plus1)12 after March of leap year.
= quotient ... remainder (earthly branch ordinal number)
According to the above method, there are two numbers to be calculated before they can be substituted into the formula, that is, the New Year's Day branch ordinal number and the monthly branch addition and subtraction number.
Heavenly stems and earthly branches addition and subtraction table:
Monthly heavenly stems and earthly branches constant addition and subtraction table
Leap year in normal year
Heavenly stems and earthly branches, heavenly stems and earthly branches.
January minus one minus one minus one minus one minus one minus one minus one.
February plus zero plus six plus zero plus six
Minus two plus ten plus one plus one in March.
April minus one plus five plus one plus one.
May MINUS one MINUS one plus one plus one.
June plus zero plus six plus one plus one.
July plus zero plus zero plus one plus one.
August plus one plus seven plus one plus one.
September plus two plus two plus one plus one.
October plus two plus eight plus one plus one.
1 1 month plus three plus three plus one.
December plus three plus nine plus one plus one.