Steinar Gunderson <[EMAIL PROTECTED]> wrote:

> OK, to complete the mess (I saw your message saying `ignore this',
> but I want to throw in my own errors as well ;-) ):
>
> If year % 4 = 0 then leap year
> If year % 100 = 0 then not leap year
> If year % 400 = 0 then leap year
> If year % 10000 = 0 then not leap year

I'm not sure about your 10000-year correction, for reasons I'll
give below (see the section about the anomalistic year below).

A favorite way of torturing beginning programmers is to ask
them to effect the above in a fashion that minimizes redundancy,
i.e. via a nested conditional structure. At the risk of grabbing
the leap year programming bug baton myself, I believe that the
resulting pseudocode segment should read as follows (I'm going
to only explicitly include corrections up to the 400-year one):

if(year % 4 = 0) then
    if(year % 100 = 0) then
        if(year % 400 = 0) then
            leap year = true
            {or add higher-order corrections here}
        else
            leap year = false
        endif
    else
        leap year = true
    endif
else
    leap year = false
endif

This kind of thing probably causes thousands of first-time
programming students to curse Pope Gregory's name each year,
although in all fairness he is only responsible for the mod
100 and 400 part of it; the mod 4 part (the so-called Julian
calendar) goes back to the reign of Julius Caesar in 45 BC.

Of course all of these are simply corrections to account for
the fact that the 'true' time for the Earth to complete one
orbit relative to the 'fixed' stars, the so-called sidereal
year, is slightly longer than 365 days, and is not (at least
in general) a rational number.

Whoops - what I really wanted was not the sidereal year (which
astronomers prefer), but the tropical year, the length of time
between successive vernal equinoxes (more interesting back
during those predominantly agrarian economic times). Silly me!

My Norton's Star Atlas (vintage 1950) lists the length of the
tropical year as 365.24219... years (ellipses mine), so one
can argue that Gregory could heve done much better by chucking
out the old one-in-four rule and finding a parsimonious rational
approximation to 0.24219..., rather than giving us the start
of the recursive nightmare listed above, but from a practical
point of view, it is desirable to be able to add corrections
to the pre-existing ones, i.e. one wants each higher modulus
to be divisible by all smaller ones. From a human-nature point
of view, one wants things to be in terms of numbers people (or
at least 16th-century popes :) are comfortable with, hence the
bias toward base-10. So you calendrically oriented recreational
math enthusiasts can work out the next few corrections, starting
with:

- the civil year, of necessity a whole number of days, 365;
- adding one leap day every 4th year gives year = 365.25 days;
- subtracting one leap day every 100 years gives year = 365.24 days.
- adding one leap day every 400 years gives year = 365.2425 days.

Now, if we subtract one leap day every 10000 years we get
year = 365.2424 days, but if we instead subtract three leap
days every 10000 years, we get year = 365.2422 days, which is
much closer to 365.24219 days. So either my Norton's has it wrong
or we need to ... yes, you guessed it ... modify the calendar yet
again!

What does any of this have to do with Mersenne primes? Let's
see if I can whip up a quick ex post facto connection:

- Pope Gregory was a Catholic; so was (arguments about which
sect and such aside); so was friar Mersenne;

- Gregory devised his modifications to the Julian calendar
in 1582; Mersenne was born in 1588, which is just six (the
smallest perfect number!) years (civil years, that is) later.

Gosh, what an amazing set of coincidences.

Gosh, look how much time I just wasted composing this.

-Ernst

_________________________________________________________________
Unsubscribe & list info -- http://www.scruz.net/~luke/signup.htm
Mersenne Prime FAQ      -- http://www.tasam.com/~lrwiman/FAQ-mers

Reply via email to