Most calendars to designed not only to keep track of the positions of celestial luminaries such as the sun and moon, but also to do so in repeating cycles. In order to facilitate the design of calendars, it is advantageous to know the periods in which those cycles repeat. I have defined a realignment cycle to be a period of a whole number of days in which a given set of cycles realigns more accurately than in any smaller number.
The following three programs can be used to design a calendar as follows. (You must have a java-enabled browser to even see the programs on this page.) First, decide on the cycles you wish to include. Then choose than number from the menu and press "Create Realignment Table." Both synodic (relative to the earth) and sidereal (sid., relative to the stars) planetary periods are given. If the cycles you wish are not on the pulldown menus, you may enter your own under "Other." You may also modify the orbital periods listed, which are average values over the last few thousand years. The "Init Error" value is the initial alignment error in days which a cycle must have to qualify to be counted. Thereafter, every smaller period will also be listed. If you enter a value in the "Error" box, then after the error becomes that small, all cycles with error below that value will print, even though they are not the best ever. In other words, if you decide that an accuracy of .2 days is good enough, then all values below .2 will be included.
If you only have one cycle, you can use the following algorithm from elementary number theory to calculate the values. It is also useful for approximating any irrational number as a ever-improving series of rational approximations. Sometimes it is nice to be able to factor the values obtained to see what units would be useful to count by, such as a week of seven days. For example, the realignment interval of 658,532 days for the lunisolar calendar has a factor of 7. Here is a factoring program:
Go to John Pratt's Home Page