Calendar: Code, Free Speech, Or Mathematics? 147
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)!"
Shucks! (Score:1)
I'm sure the canonical theory is that it was created on a Sunday, with God resting on Saturday, but of course that only comes with 14% probability of being correct.
Slash Doter
damn slashbots (Score:1)
Has someone else gotten the impression that stories are accepted or rejected using some sort of script these days? In preudo code:
A basic implementation in 1 line of code (Score:1)
00100 rem "getday - 03/16/72 (bdc)
00110 enter d0$,z1$
00120 rem d0$=day of the week, Z1$=return value
00130 let D0=MOD(NUM(D0$(7,2))+20,100)+80+SGN(SGN(NUM(D0$(1
00130:="WednesdayThursday Friday Saturday Sunday Monday Tuesday ", Z1
00130:$=Z1$(1+9*MOD(D0+INT(D0/4)+INT(MOD(NUM(D0
00130:(4,2)),7),9)
00140 exit
Re:It's all a hoax (Score:2)
Sorry... Just saw "Wargames" again recently.
Re:Correction (Score:1)
Interesting side effect (Score:1)
Anyone else notice this?
Re:metric calendar (Score:1)
Re:Here's the link through Google... (Score:2)
Re:Limitations. . . (Score:1)
"Year 19yy" is listed above the input box, and it will accept only 00-99 as input for that field.
---
Re:Limitations. . . (Score:2)
And if you want to see something weird, but nifty, type the following into your local shell prompt:
cal 9 1752
Re:Correction (Score:1)
Correction (Score:5)
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
Re:Problems w/linux hardware support (Score:3)
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.
Re:Not exactly breaking news (Score:4)
Re:Stardates (Score:1)
Heck, if you could tell what the stock market was going to do that far in the future, why not just predict it about a year in advance and make a killing? Unless that stardate really is next year...
(posted w/o a shred of sarcasm because it took me three reading to realize you meant Day-Of-Week.)
Caution: contents may be quarrelsome and meticulous!
Alternative method... (Score:2)
----
Re:Alternative method... (Score:2)
----
A Perhaps Simpler Algorithm (Score:1)
You just need to remember twelve numbers, one for each month:
Jan = 0 Feb = 3 Mar = 3 Apr = 6 May = 1 June = 4
Jul = 6 Aug = 2 Sep = 5 Oct = 0 Nov = 3 Dec = 5
(You can derive these on the fly by remembering how many days are in each month, modulo 7)
Now, subtract 1900 from your year, and take the difference modulo 7.
( 2001 - 1900 ) mod 7 ===> 101 mod 7 ===> 3
Add the number of Leap Years between the year of interest and 1900 (include the current year if it's a leap year, and the date you want is after 28th February)
(2001 - 1900) / 4 = 25 leap years
Add the two numbers, modulo 7: (25 + 3) modulo 7 = 28 modulo 7 == 0
Add the number of the month, above, modulo 7: June = 4, (4 + 0) mod 7 = 4
Add the day of the month, modulo 7: 5th June = 5, (5 + 4) mod 7 = 9 mod 7 = 2
Now, 0 == Sunday, 1 == Monday . . . 6 == Saturday, so:
5th June, 2001 is a Tuesday (if you didn't know already
Works for years prior to 1900 as well, just remember how additive moduli work with negative numbers (add, don't subtract), and subtract the number of leap years, don't add them.
Let's try 20th September, 1989 (no reason in particular):
1989 - 1900 = 89 mod 7 = 5
Number of intervening leap years: 22
September = 5
20th = 20
( 5 + 22 + 5 + 20 ) mod 7 == 52 mod 7 == 3 == Wednesday
Not sure if it's much easier than Conway's algorithm, or if I'm just used to it now. Anyway, I didn't see it mentioned elsewhere in the comments, so I thought I'd point it out.
Cheers,
Michael
Re:A Perhaps Simpler Algorithm (Score:1)
I'll go through the link again, and see if why things differ (my German needs polishing rather badly
Cheers,
Michael
Perl, in my head!?!? (Score:2)
--
Re:Alternative method... (Score:1)
I have no doubt, that as you mention in your article, that this method will take much practice and concentration...
Re:metric calendar (Score:2)
Changing the calendar is not something that people accept, there were riots when the Gregorian calendar was adopted due to people being upset that they were losing 10 days. You might say people are more rational these days, but I don't see any evidence of that.
And Conway does this pretty quickly! (Score:2)
Of course, I didn't check his answer at the time, so I presume mistakes could easily go unnoticed, but he's really good at those kinds of things. To practice he has a program in his
(I've been privileged to be one of his student and he is truly the most amazing mind I've personally met)
yes it does read the article (Score:1)
karma whore. =(
Favorite quote... (Score:1)
Ain't that the truth,
Re:metric calendar (Score:2)
According to your system the year would have only 100 days (10 days/mo * 10 mo/yr). That unfortunately is not anywhere close to reality.
A day is defined by the time it takes the earth to rotate on its axis, and a year is defined by the time it takes our earth to orbit the sun.
The two are interrelated in that the time for one orbit ~= time for 365 revolutions. i.e. 1 year = 365 days. There's nothing you can do about it.
You could go to a 10 month year, with each month having 36.5 days. (or 1/2 would have 36 days and 1/2 would have 37) But is that really gaining us anything?
To have a 100 day year as you propose, you would have to change the definition of "day" or "year", neither of which is appealing: Would yo prefer a "day" with 3.65 daylight/nighttime cycles, or having it take 3.65 "years" to complete the four seasons?
Re:Google Copy (Score:2)
(moderators: this isn't flamebait or a troll, it's just pointing out how easy it is to fool others into moderating one's post up undeservedly. You might even call it insightful =)
Re:Is the Zeller algorithm correct ? Re:Limitation (Score:2)
It should work as follows:
2 + (8*26)/10 + 73 + 73/4 + 19/4 - 2*19
= 2 + 208/10 + 73 + 18 + 4 - 38
= 2 + 20 + 73 + 18 + 4 - 38
= 79 % 7 = 2 -> Monday
Re:Limitations. . . (Score:2)
The leap year rules might be adjusted to compensate every 4000 years, or the days might be allowed to accumulate, as you suggested. Or there might be an entirely different Calendar in use. But since we don't know, it wouldn't be a good idea to try to get one of those dates, because those are much less likely to be correct.
Limitations. . . (Score:5)
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 [columbia.edu] .
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).
Re:It's all a hoax (Score:2)
Now we wait... (Score:2)
Re:Correction (Score:1)
Re:Is the Zeller algorithm correct ? Re:Limitation (Score:1)
I can do three of the Doomsday at once, no trouble...
It may have more steps, but you can remember them all at once, in bite-sized portions.
Re:Interesting side effect (Score:1)
This meant that the algorithms, and Slashdot, both had the same bright yellow-green background. Ugh!
Re:Great fun at parties? (Score:1)
Why is it called Doomsday? (Score:1)
I read this in the morning, and practised it in my head on the way to work. While thinking of random dates to try, "June 6 1945" came to my mind. by "The Hand", 0 + (1900s Doomsday) + 3 + 9 + 2 = (you guessed it) the 1900s Doomsday!
Having found this, I now remember everything perfectly
Also, some of you may not have picked up on the fact that this article was penned cleverly: instead of brashly stating facts and expecting memories, he deliberately leaves out some critical deductions, but hints very strongly at them. It is ten times easier to remember something you worked out yourself, than something you saw somewhere.
Re:Limitations. . . (Score:2)
--
Mathemagician and penny experiments (Score:1)
I did, and it ends in an intriguing claim (and demonstration) from Conway that if one stands pennies on their side on a table, and bumps the table, all the pennies will land heads-up. And that if spun, pennies will land 2/3 of the time tails up. (Appropriate physics reasons are given for the surprising behavior.)
I tried this with a sample of 10-20 pennies from my jar and was not able to duplicate the findings. (In the 2 trials I had patience for, I got heads up 2/3 of the time with both table-thumping and coin-spinning.) I'd have done more trials but I was at work, albeit on a dinner break. ;) Has anyone else heard of this or checked it out?
--LP
Re:Mathemagician and penny experiments (Score:1)
/dev/bong (Score:1)
Re:child geniuses (Score:1)
I agree that I'm not sure how remarkable it is that this algorithm can merely be computed in ones head. However for people who have never had the algorithm described to them, (maybe the savant had allready read about this algorithm, who can be sure), it shows great ingenuity to come up with an algorithm like this for themselves.
It's not the act of executing the algorithm that would make them genius material. It's whether they read the solution and were good at menial math, or whether they were inventive and (re)created an algorithm themselves.
Not exactly breaking news (Score:2)
Re:why the free speach worries? (Score:2)
Hey... (Score:5)
Have a nice day,
Calendar Makers Association of America.
Re:Limitations. . . (Score:2)
There are a few very minor limitations on this algorithm that are not mentioned on the page. [...] The algorithm uses the Gregorian Calendar.
The example preceding the #Origins section of the page describes the same issues about the Gregorian calender, including the fact that the Gregorian dates weren't adopted everywhere instantly.
As for which is better for the job, I'll take Doomsday over Zeller. If I wanted a method that required integer division, I'd get out my calculator. Many sufficiently advanced calculators have a shortcut to calculate this, anyway. Perhaps Doomsday is to Bresenham as Zeller is to Interpolation.
Re:It's all a hoax (Score:1)
There's an easy way to win at Keno - don't play. If you're looking to win at gambling, first remember that hotels are big and fancy for a reason, and second, play blackjack - that's as close as you're going to get to having "good" odds.
The Good Reverend
I'm different, just like everybody else. [michris.com]
Re:why the free speach worries? (Score:2)
The Good Reverend
I'm different, just like everybody else. [michris.com]
Re:It's all a hoax (Score:2)
The Good Reverend
I'm different, just like everybody else. [michris.com]
why the free speach worries? (Score:5)
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. [michris.com]
Is the Zeller algorithm correct ? Re:Limitations. (Score:1)
Re:Interesting side effect (Score:1)
It's all a hoax (Score:1)
Re:It's all a hoax (Score:1)
Re:It's all a hoax (Score:1)
Re:It's all a hoax (Score:1)
Re:It's all a hoax (Score:1)
Delrin Kenro
Re:It's all a hoax (Score:2)
Here's the article I was talking about (Score:2)
- Corriveau used an "antique 286" computer to analyse 7,000 combinations from the keno game, [which uses an electronic pseudo-random number generator].
- The Casino managers shut the game down and called the police.
- The Surete du Quebec [provincial police] fraud squad investigated; Corriveau and his family even took polygraph tests.
Might want to look on yahoo or somewhere to find the details of the actual judgement. Though I am pretty sure he was let off completely.
Re:metric calendar (Score:1)
Re:Correction (Score:2)
I think he was speaking to most of the readers of this site. I can do it in my head easily enough.
aw gimme a break! (Score:1)
Re:It's all a hoax (Score:1)
--
John Conway (Score:1)
One of the most interesting things he showed us was how to find Pi from a game of pool - no tricks! I forget the exact method, but I think you took two balls of equal mass, hit them together, and looked for how many times the second would hit the wall before stopping. And then you changed the mass ratio to 10-1, then 100-1, and so on.
There's a newer version (Score:1)
Re:Limitations. . . (Score:1)
$ cal 9 1752
September 1752
Su Mo Tu We Th Fr Sa
17 18 19 20 21 22 23
24 25 26 27 28 29 30
$
There were riots in the streets over this.
--
Re:why the free speach worries? (Score:1)
Algorithms aren't (supposed to be) patentable. Mechanisms or processes which employ algorithms may be patentable. It's a subtle distinction (and one that's let a few algorithms slip through), but I don't think this would be patentable, as it can be done by head and hand (see Gottschalk v. Benson).
The other speech commentary is sheer idiocy. So it's a copyrightable poem; so what? Copyright would only protect the poem, not the algorithm. Free speech is a complete non-issue.
Re:why the free speach worries? (Score:1)
Free and protected how? The protection 2600 was talking about was based on the First Amendment; they claimed free-speech concerne overrode the DMCA's provisions against disseminating the DeCSS code.
This isn't an example of that kind of First Amendment protection, because nobody has tried to prohibit this speech.
This story has nothing to do with DeCSS (Score:1)
Here's a comparison with the legal status of the DeCSS algorithm: the DeCSS algorithm is the subject of a lawsuit because it circumvents an encryption scheme and may therefore be illegal under the DMCA. The Doomsday algorithm is not the subject of any lawsuit, has nothing to do with encryption, and the DMCA has no bearing on it. Conclusion: the Doomsday algorithm does not affect the DeCSS case in the slightest.
Re:This story has nothing to do with DeCSS (Score:1)
I'm not an obvious troll; an obvious troll posts goatsex links. I just try to let people know when they're seriously misinformed about the law.
And my point is that where this statement isn't just plain wrong (something is not automatically protected speech just because it can be expressed in a natural language), it's meaningless (protected against what?).
Well, obviously. Time, place and manner restrictions have always worked this way.
Re:Easy to remember? (Score:1)
_________________________
I have an easier way... (Score:1)
Linux: An OS for the Masses: Rosanne Barr and Tom Arnold
This message was encrypted with rot-26 cryptography.
Bigger margins (Score:2)
but the margin is too small to contain it...
You have all the margin you want at Everything [everything2.com], the Internet's most popular collaboratively filtered database and writing community. (See also what I've written [everything2.com].)
Re:Limitations. . . (Score:1)
Re:Great fun at parties? (Score:1)
OK, I can admit that the trick for getting the doomsday for a year in a century might take some training to memorize, but for the base (centuries) you only need to memorize 4 days - it's a nice, short period. As for the leap years, that's stuff you usually pick up in kindergarten ... come on here, read the whole article, not just the first screen of it ... you know what that grey bar on the right side of the text means?
Re:child geniuses (Score:1)
That said about this particular case, in the general you have a point.
child geniuses (Score:2)
- Young Sidis astounded guest with his remarkable ability to calculate the the day of any given day in a matter of seconds, using an algorithm he had invented himself.
While Sidis undoubtly was a real prodigy, many others that are attributed with this "remarkable ability" aren't. That they are nevertheless labeled so is probably mostly due to biographers (like Wallace) overestimating the difficulty of this particular task. Not that this is really important or anything, but it always annoys me when people gravely overestimate someone's intellectual capacity merely because of simple tricks.Re:Interesting side effect (Score:1)
Anyone else notice this?
I did. Both the grey and the green text looked just as green up front; I thought CT was trying to be cutesy. I read on and forgot about it, but when I read your post it caught my attention: grey looked grey again, which is a good thing...
I think that what really happened was that because that page background is green, the white in this page tends to look rosy. making the grey look green in contrast.
Re:Interesting side effect (Score:1)
Re:Mathemagician and penny experiments (Score:1)
Can't tell from the article whether they are UK pennies or US (is there such a thing?)...
Knuckle thing (Score:1)
Re:Great fun at parties? (Score:1)
Busted... now everyone at work is wondering why I burst out laughing.
Re:Correction (Score:2)
Re:Correction (Score:2)
Google Copy (Score:2)
Here is the link to the copy in the Google Cache [google.com]
enjoy!
(oops - forgot the password)
Check out the Vinny the Vampire [eplugz.com] comic strip
Re:Google Copy (Score:2)
No accounting for taste, of course. I'll pass the info on to the pair running it, a couple of of my teenage nephews.
(gotta help out family and all that)
Check out the Vinny the Vampire [eplugz.com] comic strip
Re:Google Copy (Score:2)
Considering I tried to access it from work where we have the usual t-1 line, it I couldn't get it, what was I supposed to think? after all, not everyone has an OC line
And I've been maxed for months. I wish they would tweak/fix the moderation system so that I could use some more of the karma.
Check out the Vinny the Vampire [eplugz.com] comic strip
Neater code (Score:2)
int dow(int m,int d,int y)
{y-=m<3;return(y+y/4-y/100+y/400+"-bed=pen+mad. "[m]+d)%7;}
Even though it only works for "a restricted range." This comes from here [cs.unb.ca], which has some other information too.
Re:Limitations. . . (Score:5)
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...
Re:It's all a hoax (Score:3)
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..
Re:Not exactly breaking news (Score:2)
Yeah, it started on a Wednesday, to be exact.
Build your own Perpetual Calendar (Score:2)
But I think I could manage to make four paper strips [geocities.com] and fold them around a pencil, or build this cardboard contraption [4000yearpe...lendar.com], or even try tattooing this stuff [geocities.com] on various body parts like the guy in Memento.
I might try this interactive calendar [alabanza.com] to find the Doomsday to start the algorithm process, but then I wouldn't need to remember the algorithm, would I? I would be most likely to consult my desk copy of Farmer's Almanac [almanac.com], then the only thing I would have to remember is where I put it.
Resisting the urge to shout "How are you, gentlemen?" every time I pass the "gentlemen's room" at work.
In my head?!? (Score:2)
Maybe, but only if one of the steps included in my head is telling myself "Remember where you put the printout to that page, dumbass."
Dr Who anual of 1978 (Score:2)
A much simpler algorithm is
The SAS survival handbook lists hundreds of ways to stay alive in artic wastes armed with only a rusty can opener. Me I go down to the supermarket.
Technology is good, folk should try it sometime.
Re:why the free speach worries? (Score:2)
Well, if it catches on, calendar makers will be out of business, and we can't have that.
Seriously I think this is a swipe at the anti-DeCSS crowd, who are trying to argue that computer code (and, by extension, mathematical algorithms) are not protected speech.
Ryan T. Sammartino
Re:It's all a hoax (Score:2)
Horse racing is better, since you aren't competing against the house (they just take a fixed cut), but rather you're competing against the other gamblers.
My best summer job was working at the local race track and watching my high school principal gamble away his daughter's inheritance week in, week out.
Ryan T. Sammartino
Editors are Retarded (Score:2)
I am accepting donations for more bow-ties and a new pair of coke bottle glasses.
Razzious Domini
Re:Limitations. . . (Score:5)
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!
Easy to remember? (Score:4)
I'll stick to using my calendar, thank you very much!
---
An open source application uses this algorithm (Score:4)
Source code available at webware.skybuilders.com [skybuilders.com]
The calendar built by this page is part of skyBuilders timeLines [skybuilders.com]
dtd
Any sufficiently advanced technology is indistinguishable from magic.
- Arthur C. Clarke