Slashdot Mirror


Calendar: Code, Free Speech, Or Mathematics?

jdavidb writes: "Dr. John Conway (author of the famous "Game of Life") has a wonderful algorithm for finding the day of the week for any year in history that you can do in your head. It's so easy and elegant, in fact, that someone has decided to write a poem about it. Shades of DeCSS haikus! What a marvelous example of how mathematics is a form of (free and protected) speech. As if to further illustrate that computer code is just another form of speech, there is an implementation of this algorithm (in Perl of course)!"

11 of 147 comments (clear)

  1. Correction by waldoj · · Score: 5

    ...has a wonderful algorithm for finding the day of the week for any year in history that you can do in your head.

    That should read "...that one can do in one's head." I could no sooner do that in my head than I could give birth.

    -Waldo

  2. Re:Problems w/linux hardware support by Cid+Highwind · · Score: 3

    Pure FUD.
    Linux has supported bongs with any number of chambers since kernel 2.4.1 The generic waterpipe driver has been re-written from the ground up to support bongs up to 1024 inches. The only trouble items are the so-called winpipes. These pipes don't have an actual bowl, they're just an empty tube and a driver that makes windows *act* like it's stoned. Due to poor real-world performance and their unsatisfactory smoking experience, they are unlikely to ever be supported.

    Hookah support for multiple users is now available through the tokin' ring network device. The new tokin' ring driver also supports 128-bit encryption of the smokestream, to prevent "sniffing" of the connection by local police.

    --
    0 1 - just my two bits
  3. Re:Not exactly breaking news by PD · · Score: 4

    Whining about old news has been around since Ecclesiastes, and whining in general is even older...

  4. Limitations. . . by SMN · · Score: 5
    There are a few very minor limitations on this algorithm that are not mentioned on the page. In fact, these limitations are ignored, and lead several mistakes on that page.

    The algorithm uses the Gregorian Calendar. Most countries did not adopt the Gregorian Calendar until October 15, 1582, and therefore it is inaccurate for any date before that. The major exception is Great Britian which, due to the feud between the Catholic and Anglican Churches, did not adopt the Gregorian Calendar until September 14, 1752.

    This means that the "Doomsday"'s before 1583 are all wrong everywhere, and those before 1753 are wrong in Great Britian.

    In addition, the Gregorian Calendar only considers Leap Year exceptions on a 400-year cycle, so in the year 4092 it will have drifted off by one full day. Therefore, this algorithm should not be used for any date past December 31, 4091.

    In my opinion, the Doomsday algorithm isn't even the best algorithm for this job. I prefer Zeller's Algorithm, for a which a good description can be found at http://www.columbia.edu/ ~cs1005/HW03.html .

    Zeller's Algorithm was first proposed by Chr. Zeller, in 1883 -- long before computers. It also allows one to find the day of week for a date using only integer division, and thus can be done easily by hand. It's much simpler than the Doomsday Algorithm appears to be.

    I can't post it here correctly due to formatting limitations, but it can be found at the above lined page. It's slightly harder to memorize, but simpler to use (and program -- only took me a few minutes).

    --
    -- Imagine how much more advanced our technology would be if we had eight fingers per hand.
    1. Re:Limitations. . . by sv0f · · Score: 5

      I can't post it here correctly due to formatting limitations, but it can be found at the above lined page.

      I have discovered a marvelous algorithm for finding the day of the week for any date in history but the margin is too small to contain it...

    2. Re:Limitations. . . by bark76 · · Score: 5
      In addition, the Gregorian Calendar only considers Leap Year exceptions on a 400-year cycle, so in the year 4092 it will have drifted off by one full day.

      WOO HOO! That means that by 744,744AD our winters will be in the summer and vice versa, it'll be like we're living in Australia!

  5. Hey... by Moonshadow · · Score: 5

    This code circumvents the obfuscation put in place by the Romans way back when by allowing the masses to find the weekday equivalents of any day in history! This must be stopped! Why, if this information leaks to the masses, we'll have rebellion and revolution, and it's only a matter of time before calendar makers' proprietary secrets are laid bare, depriving them of their hard-earned money! Rest assured that we will be filing a lawsuit against the author of this code, and any who distribute it. Such criminal "crowbars" cannot be allowed to proliferate to the masses!

    Have a nice day,

    Calendar Makers Association of America.

  6. why the free speach worries? by The+Good+Reverend · · Score: 5

    What a marvelous example of how mathematics is a form of (free and protected) speech.

    Has someone tried to claim a patent on this? It's a neat little math trick, but the poster seems a little paranoid. Should we not tell the world that the digits in numbers divisible by three add up to three, in case someone tries to patent that too? It doesn't seem like this is a big problem. or even a free speech issue.

    The Good Reverend
    I'm different, just like everybody else.

  7. Re:It's all a hoax by pcidevel · · Score: 3

    Actually, I was making a "witty" commentary on something that happened here in montreal. A hyper-addicted gambler watched and recorded all the kino games for a period of time. And found a flaw in the so-called "random" number generation (computerised), he successfully was able to predict the outcome on a large number of occasions, and the Casino tried to sue him for the money back.. unsuccessfully. They then started using real balls to get the numbers. :)

    Actually that definately was not a 'flaw' persay other than the fact that the pseudo random number generator must have been displaying every number called in order.. ALL pseudo random number generators (i.e. every computer generated random number sequence) is a repetive sequence.. given the same seed it will produce the same results.. it's a fact of life, random number generation isn't possible algorithmically.. I know, I used to write them for gambling applications for a living.. What the player must have done was sit through enough iterations of the random number generator to realize what the pattern was (say, they seeded with time, using only the hours and minutes, and if the game started at 9:00 the numbers would always be the same).. I have heard rumors about this kinda stuff happening.. but I have never seen any REAL proof that a programmer was lax enough to get this out on the market.. In fact when some of my games went through the regulatory procedures, people at the agencies that verified the games had basically the same story (urban legend?) happening in atlantic city casino's.. funny enough, every time I've heard it it's been keno, but I would think there would be much easier and less detectable games to do this with (computerized blackjack)..

    It's important to realize that just like counting cards at a poker game in Vegas, this IS illegal and I'm quite sure that if it could be proven it the casino would win a lawsuit (and probably the person counting the deck so to speak would serve jail time also)...

    We got around this with our generator by selecting numbers from the deck even when we weren't being asked for a number, so a 'random' amount of numbers were drawn in between each time that a 'random' number was drawn.. that and the random seed was not only second from epoch but a serial number and various other things (like the content of a 'random' location in memory) all added together..

    Every gaming market I have been too requires at LEAST a Chi-Square test on the generator to ensure even distribution of random numbers.. Most test the random number generator much more vigorously.. I can't imagine something slipping into the field that a player could cheat easily.. It seems to me that probably this is a legend that started with someone with basic random number generator knowledge saying "Hey, theoretically you could cheat these generator's IF..." that got spread into a real legend that it happened.. but then again.. I've met some poor programmers in my time, and seen extremely lax validation agencies.. so it's possible that something like this really happened.. :)

    --

    I thought someone said there was going to be free beer!

  8. Easy to remember? by Purple_Walrus · · Score: 4

    "Easy to remember" means remembering your own name. "Easy to remember" means basic rules of addition. This is more like "painstakingly difficult to remember under any circumstances."
    I'll stick to using my calendar, thank you very much!
    ---

    --
    ------
    Sig
  9. An open source application uses this algorithm by ayers · · Score: 4
    CalendarBuilder.asp, a combination VBScript/JavaScript Server Page implements this algorithm.

    Source code available at webware.skybuilders.com

    The calendar built by this page is part of skyBuilders timeLines

    dtd

    Any sufficiently advanced technology is indistinguishable from magic.
    - Arthur C. Clarke