|
|
|
| Listing 6.7 golden_number () | |
|
|
|
|
/* gold_num.c
+-------------------------------------------+
| Copyright (C) 1995 by Lance W. Latham. |
| All rights reserved. |
+-------------------------------------------+
Returns the golden number, or 'numerus aureus', for a given year
in the nineteen-year Metonic cycle.
INPUTS:
1. year, type int, the year (A.D.) in the Western calendar for which
the golden number is desired. Valid values are those for type int.
OUTPUTS:
1. Returned by routine, type int, the golden number of the input year.
Valid values are 1 through 19.
NOTES:
1. The Golden Number is the number of the year, from 1 to 19, in
the Metonic cycle. Meton, an Athenian astronomer, is credited
with discovering the fact that the number of days encompassed by
235 lunations is a close approximation to the number of days included
in the period of 19 years, which was therefore called a 'Lunar Cycle'.
According to legend, the discovery earned Meton a plaque of gold,
leading to the name 'golden number'. There is good evidence that
the Chinese knew of this relationship several centuries before the
Greeks. The number is used to relate average lunar and solar time
periods in several applications, and was used extensively in the
calculations for Easter date.
2. This routine accepts negative years as well, returning the value
which corresponds to the position in the Metonic cycle. This
extension to the concept allows the use of the 'astronomical'
year number convention - year 0 is 1 B.C., etc. Derivation of
the rule follows from consideration of the following table, where
Y is year and G is the golden number:
Y : 20, 19, 18, . . ., 3, 2, 1, 0, -1, -2, -3, . . ., -18, -19, -20
G : 2, 1, 19, . . ., 4, 3, 2, 1, 19, 18, 17, . . ., 2, 1, 19
The test for G = 20 corrects the output for the single case that
Y < 0, and G (-Y) = 1, so that 21 - 1 = 20. This case occurs for
any Y where Y = (N * -19), N an integer. This is a brute force
correction to a modulo 19 result for the single case.
*/
int golden_number (int year)
{
int g;
if (year < 0)
g = (21 - (((-year) % 19) + 1));
else
g = ((year % 19) + 1);
if (g == 20)
g = 1;
return (g);
}
|
|
|
|
|
|
|
|