* WalrusIRC

You need to have 5 posts and not be part of restricted usergroups in order to use the WalrusIRC embedded shoutbox. However, you can also access our IRC channel called #CodeWalrus via EFnet.

Author Topic: Today Is The Day After Doomsday  (Read 1554 times)

0 Members and 1 Guest are viewing this topic.

Offline JWinslow23

  • Pi is wrong. Tau > Pi
  • Super User
  • CW 4x3 challenge - 2nd place
  • *
  • Join Date: May 2015
  • Location: Somewhere between 13 and Graham's Number
  • Posts: 699
  • Post Rating Ratio: +9/-1
  • Pi is wrong. Use Tau...it's easier than Pi!
    • @UCu_9qD95nADzc-W6RN-3Z8A
    • 113/11328
    • View Profile
  • Gender: Male
Today Is The Day After Doomsday
« on: December 20, 2015, 09:02:30 am »
WARNING: The following post includes math concepts and calendar calculations that certainly are NOT for the faint of heart. :P
As well, at request of c4ooo, I have put the equivalent mathematical equations in spoilers below each method. Please don't hate me...I eat my cereal dryyyyyyyy :P


No, not that kind of Doomsday :P

As a geek, I have some weird, strange, burning obsessions from time to time. A lot of these have to do with math. This time, it is calendar math. Specifically, a way to calculate the day of the week for any given date. Since we haven't adopted the World Calendar system yet, it's hard to find the day of the week if you're given a random date. For example, what day of the week was March 10, 1985? Don't use a calendar!
(click to show/hide)
See, it's hard to figure it out. And you only have a ~14.28% chance of guessing randomly, which isn't great. So what do we do? Well...in short, that depends on who you're talking to.


Purely Mathematical Methods

Math is a wonderful tool. You can use it for many different practical purposes...including and especially finding the day of the week. Here are a few popular methods for computing this.

Zeller's Congruence

Christian Zeller is a German mathematician, who specialized in this sort of mathematics. He had created a method for calculating the day of the week, given in a formula that goes like this:


The one disadvantage of this method is the unusual month counting convention; any date in January or February is treated as months 13 and 14 in the previous year. However, feeding in the "correct" numbers for month, day, and year will adjust for you.

Gauss' Algorithm

Johann Carl Friedrich Gauss, another German mathematician, had described a method for calculating the day of the week for January 1st in any given year (only applicable to the Gregorian calendar), which was never published. The formula is this:


There have been modifications made to this to apply to any date, instead of only January 1st, which works in any calendar system. One such modification is as follows:


Mike Keith's C expression

In 1990, an American mathematician and constrained-writing author named Mike Keith published the following terse self-contained C expression for calculating the day of the week of any day in the Gregorian calculator:
Code: [Select]
(d+=m<3?y--:y-2,23*m/9+d+4+y/4-y/100+y/400)%7This is equivalent to the following mathematical expressions:

This is equivalent to the following TI-BASIC code (with month, day, and year stored in M, D, and Y, and the result will be in Ans)[1]:
Code: [Select]
:Y-(M<3
:round(7fPart((int(23M/9)+D+4+Y+int(Ans/4)-int(Ans/ᴇ2)+int(Ans/400)-2(M≥3))/7),0


Mental Calculation Methods

Just in case you don't have a high-speed computer (or TI-83+ calculator) with you at all times, here are some methods ENTIRELY involving memorization and mental calculation. You know...if you're into that sort of thing ;)

Carrollian Method
Charles Lutwidge Dodgson (aka Lewis Carroll, famous for Alice's Adventures in Wonderland and Through the Looking Glass) was an insane writer by day, and an insane mathematician by day also. He had discovered his own method of determining this (which was in Martin Gardner's book The Universe in a Handkerchief: Lewis Carroll's mathematical recreations, games, puzzles, and word plays ), which goes as follows (my attempt to put it in clear English language):
  • Calculate 4 numbers based on the century, the years past the century, the month, and the day of the month.
  • #1: Century
    • For "Old Style" (Julian[2]; valid up to September 2, 1752[3]), subtract the century from 18.
    • For "New Style" (Gregorian; valid from September 14, 1752 onwards[3]), divide the century by 4, subtract the remainder from 3, then double that.
  • #2: Year
    • Add the number of "dozens" that go in the year, the remainder, and the number of 4s that go in that remainder.
  • #3: Month
    • If the month is January, the number is 0.
    • If the month is February or March, the number is 3.
    • If the month is December, the number is 12.
    • If the month starts or ends in a vowel (y excluded), subtract the month number from 10 (i.e. April is month 4, so for April, 10-4=6).
    • For any other month, take the number for the month before it, and add the number of days in that month (i.e. April=6, so May=6+30=36).
  • #4: Day
    • The item is simply the day number.
    • HOWEVER, you must subtract 1 if the date is January or February in a leap year.
    • Reminder: Every year divisible by 4 is a leap year, except an even century in "New Style" (Gregorian) where the number of centuries is not divisible by 4 (i.e. 1976 is, 2000 is, 1900 is not).
  • Sum these 4 numbers, divide by 7, and take the remainder.
  • The total is the day of the week (0=Sunday, 1=Monday, etc.)
(click to show/hide)
This is very cryptic, and hard to understand why it works (vowels in a month name have significance?), but it works!

Relevant formulae for "Carrollian" method:
(click to show/hide)

Doomsday
A much-simpler-to-understand-why-it-works formula comes from John Horton Conway (famous for his cellular automaton called The Game of Life[4]), and is called the Doomsday Algorithm (named so because he wanted the name to end in -day, and "Dooms-" was the first thing that popped in his head). The principle is this: "Doomsday" is the day of the week of the last day in February in any year, and many easy-to-remember dates fall on Doomsday each year.

A list of some memorable Doomsdays in a year:

MonthMemorable DoomsdaysMnemonics
January3 (common), 4 (leap)
10 (common), 11 (leap)
31 (common), "32" (leap)
the 3rd for 3 years, and the 4th every 4
repeated number (1/11) in leap years, 1 day before in common years
last day of January (but pretend January has 32 days in leap years)
February"0" (common), 1 (leap)
14 (common)
21 (common), 22 (leap)
28 (common), 29 (leap)
binary: is this year a leap year? (0=false, 1=true)
Valentine's Day
repeated number (2/22) in leap years, 1 day before in common years
last day of February
March"0"
14
last day of February (i.e. the day before March 1)
Pi Day ;)
April4repeated number (4/4)
May9"I work 9 to 5 at 7-11[5]"
June6repeated number (6/6)
July4
11
Independence Day (USA)
"I work 9 to 5 at 7-11[5]"
August8repeated number (8/8)
September5"I work 9 to 5 at 7-11[5]"
October10
31
repeated number (10/10)
Halloween
November7"I work 9 to 5 at 7-11[5]"
December12
26
repeated number (12/12)
Boxing Day (i.e. the day after Christmas Day)
All of the dates above (and many more, yet less memorable, ones) all fall on Doomsday in a year.

To calculate Doomsday, Conway presents this method:
  • Take the "anchor day" for the century from a lookup table.
    Century mod 4[6]0123
    Anchor dayTuesdaySundayFridayWednesday
    e.g. From 1900 to 1999, the century mod 4 is 19 mod 4 = 3, so the anchor day is Wednesday.
  • Add the number of "dozens" that go in the year, the remainder, and the number of 4s that go in that remainder.[7]
  • Count that many days from the anchor day. That day is Doomsday.
    e.g. For 1958, 58/12=4, remainder 10. 10/4=2, remainder 2. 4+10+2=16=2 mod 7.
    2 days from Wednesday=Friday.
From here, it's a matter of day and week counting in your head from the Doomsday and dates you've remembered.

Relevent formulae for Conway Doomsday method:
(click to show/hide)

"Odd+11"
Of course, there's always a better way :P , and in this instance, the processes of dividing by 12 and 4 in step 2 of BOTH mental methods so far can be simplified further for mental calculation. It's been done three times to my knowledge, but one of the easiest methods, called the Odd+11 method, is described here:
  • Let Y be the 2-digit year.
  • If Y is odd, add 11.
  • Divide Y by 2.
  • If Y is odd, add 11.
  • Take Y mod 7.
  • Get the 7's complement, i.e. subtract from 7 (unless the number is 0, in which case the 7's complement is 0).
  • The final result is your offset.
  • e.g. For 1958:
    • 58 is even, so do nothing.
    • 58/2=29.
    • 29 is odd, so 29+11=40.
    • 40 mod 7=5.
    • 7-5=2.

Relevant formulae for Odd+11 Doomsday method:
(click to show/hide)



I have a challenge for you: take your birthday (or any other day, so long as you tell me its significance), and find the day of the week it occurred on. Use any of the methods described above, but show your work!

Example: My birthday is January 23, 2001.
Using Doomsday with the Odd+11 method:
Anchor day for 2000 = Tuesday
1 is odd, so 1+11=12.
12/2=6.
6 is even.
7's complement of 6 is 1.
Doomsday 2001 = Tuesday+1 = Wednesday.
Closest memorable Doomsday: January 31 (common year)
January 31, as well as January 31 - 1 week = January 24, is a Wednesday.
January 23 is 1 day before January 24.
Therefore, January 23 is 1 day before Wednesday = Tuesday.

Well, that's the end of my rant about my latest math geek obsession. Have fun with it, and I hope you find it useful! Also, if you have any questions, ask me and I'll explain.


[1]: I actually wrote this code back in November 2013! Wow, I guess this "obsession" of mine is old :P
[2]: Julian is referring to New Style Julian, which means that the New Year starts on January 1 (in contrast to Old Style Julian, which means that the New Year starts on March 23).
[3]: September 2, 1752 in Julian is the day before September 14, 1752 in Gregorian. The switch between calendar systems in most regions (not all) happened between those days. That's right, there's another calendar discrepancy to worry about. :P
[4]: You lost the game.
* JWinslow23 runs :P
[5]: 9:00 AM to 5:00 PM are traditional working hours, and this has evolved into the slang expression "9 to 5". 7-Eleven is a chain of convenience stores around the world.
[6]: mod refers to modular arithmetic, i.e. numbers wrapping around after a certain point. For example, 8 bit numbers on an NES or TI-84+ work in modulo 256 arithmetic, because values go from 0 to 255, and wrap around.
[7]: Yes, this step is the same as in the Lewis Carroll algorithm! Both are actually a simplification of the "true" formula, y+int(y/4) . It's hard to divide large values by 4 in your head.
« Last Edit: December 21, 2015, 05:46:56 am by JWinslow23 »


  • Calculators owned: TI-84+, TI-84+ CSE, TI-84+ CE

Offline Snektron

  • Lvl 69 Russian Snake
  • CodeWalrus Staff
  • Super User
  • Topic Management
  • Join Date: Dec 2014
  • Location: Netherlands
  • Posts: 3144
  • Post Rating Ratio: +31/-0
  • SSSssssss.....
    • RobinDeWalvis
    • Kzyrox
    • RobinDeWalvis
    • View Profile
    • quantuminfinity
  • Gender: Male
Re: Today Is The Day After Doomsday
« Reply #1 on: December 20, 2015, 10:09:44 am »
That's a lot of math :P You probaly could do something with the amount of days in a year too (no, not 365 or 366, but 365.242199)
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Offline JWinslow23

  • Pi is wrong. Tau > Pi
  • Super User
  • CW 4x3 challenge - 2nd place
  • *
  • Join Date: May 2015
  • Location: Somewhere between 13 and Graham's Number
  • Posts: 699
  • Post Rating Ratio: +9/-1
  • Pi is wrong. Use Tau...it's easier than Pi!
    • @UCu_9qD95nADzc-W6RN-3Z8A
    • 113/11328
    • View Profile
  • Gender: Male
Re: Today Is The Day After Doomsday
« Reply #2 on: December 20, 2015, 10:20:58 am »
Well, that would certainly get you closer towards an astronomical calendar :P . We're concerned with our own at the moment though.

And sure, that's a lot of math, but it's really not so hard to do. The simplest way I've shown is nothing more than a lookup in a table, some addition and division by 2, and counting off days.

Offline alexgt

  • Just your friendly neighborhood Ninja Stach Fancy Iron Man
  • Super User
  • Join Date: Dec 2014
  • Location: Behind you
  • Posts: 2610
  • Post Rating Ratio: +6/-1
  • Something should go here...
    • /u/alexgt9123
    • View Profile
  • Gender: Male
Re: Today Is The Day After Doomsday
« Reply #3 on: December 20, 2015, 02:42:55 pm »
O.O nice I personally don'y believe in dooms day but I do believe in math, thanks for teaching me a few things ;)
  • Calculators owned: Ti-84+, Ti-Nspire, Hp Prime, Broken HP Prime, HP 48SX

Online c4ooo

  • ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
  • Super User
  • CW Contest II Winner
  • *
  • Join Date: Aug 2015
  • Location: 127.0.0.1
  • Posts: 825
  • Post Rating Ratio: +7/-2
  • ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
    • View Profile
  • Gender: Male
Re: Today Is The Day After Doomsday
« Reply #4 on: December 20, 2015, 07:17:23 pm »
Wait what... you where born Jan 23, 2001? O.O
 :w00t: :w00t: :w00t: :w00t: :w00t: :w00t: :w00t: :w00t:

About the vowel thing, does that mean that this only works in english? :P
??? ??? ???

Offline JWinslow23

  • Pi is wrong. Tau > Pi
  • Super User
  • CW 4x3 challenge - 2nd place
  • *
  • Join Date: May 2015
  • Location: Somewhere between 13 and Graham's Number
  • Posts: 699
  • Post Rating Ratio: +9/-1
  • Pi is wrong. Use Tau...it's easier than Pi!
    • @UCu_9qD95nADzc-W6RN-3Z8A
    • 113/11328
    • View Profile
  • Gender: Male
Re: Today Is The Day After Doomsday
« Reply #5 on: December 20, 2015, 08:06:33 pm »
O.O nice I personally don'y believe in dooms day but I do believe in math, thanks for teaching me a few things ;)
It's not that kind of Doomsday (according to Conway, "anchor day" would have been more appropriate), but you're welcome.
Wait what... you where born Jan 23, 2001? O.O
 :w00t: :w00t: :w00t: :w00t: :w00t: :w00t: :w00t: :w00t:

About the vowel thing, does that mean that this only works in english? :P
Yes, I was born in 2001. My 15th birthday is coming up in a month and 3 days.

Also, that was just a way for Dodgson (Carroll) to describe the month table...without using a table. What the table really is is this:

MonthJanuaryFebruaryMarchAprilMayJuneJulyAugustSeptemberOctoberNovemberDecember
Month "value"0315990120151181212243273304334

which is the number of days in that year that passed before the start of that month (with February counting as 28 days). This is equivalent to Dodgson's list in mod 7 (which is all that matters, because adding or subtracting 1 week doesn't change the result).

MonthJanuaryFebruaryMarchAprilMayJuneJulyAugustSeptemberOctoberNovemberDecember
Dodgson's month "value"03363643423303112

Remember this in whatever pattern you want. You can also use this completely-reduced table for reference, knowing that adding or subtracting 7 has no effect on the "correctness" of the value:

MonthJanuaryFebruaryMarchAprilMayJuneJulyAugustSeptemberOctoberNovemberDecember
Reduced month "value"033614625035

Offline JWinslow23

  • Pi is wrong. Tau > Pi
  • Super User
  • CW 4x3 challenge - 2nd place
  • *
  • Join Date: May 2015
  • Location: Somewhere between 13 and Graham's Number
  • Posts: 699
  • Post Rating Ratio: +9/-1
  • Pi is wrong. Use Tau...it's easier than Pi!
    • @UCu_9qD95nADzc-W6RN-3Z8A
    • 113/11328
    • View Profile
  • Gender: Male
Re: Today Is The Day After Doomsday
« Reply #6 on: December 21, 2015, 01:56:28 am »
Bump.

I have added purely mathematical methods, for those interested. I even gave some TI-BASIC code I wrote over 2 years ago! Times really haven't changed :P

Offline alexgt

  • Just your friendly neighborhood Ninja Stach Fancy Iron Man
  • Super User
  • Join Date: Dec 2014
  • Location: Behind you
  • Posts: 2610
  • Post Rating Ratio: +6/-1
  • Something should go here...
    • /u/alexgt9123
    • View Profile
  • Gender: Male
Re: Today Is The Day After Doomsday
« Reply #7 on: December 21, 2015, 02:14:10 am »
Cool ;), and pun intended?! :P
  • Calculators owned: Ti-84+, Ti-Nspire, Hp Prime, Broken HP Prime, HP 48SX

Offline Araidia

  • Full User
  • Join Date: Sep 2015
  • Location: USA
  • Posts: 230
  • Post Rating Ratio: +0/-0
    • 3648273
    • View Profile
  • Gender: Male
Re: Today Is The Day After Doomsday
« Reply #8 on: December 21, 2015, 05:18:39 am »
Thought you guys were talking about the December 21 2012 doomsday scare...
  • Calculators owned: TI84+ CE

Also Known as: Soul | Enguard

Offline JWinslow23

  • Pi is wrong. Tau > Pi
  • Super User
  • CW 4x3 challenge - 2nd place
  • *
  • Join Date: May 2015
  • Location: Somewhere between 13 and Graham's Number
  • Posts: 699
  • Post Rating Ratio: +9/-1
  • Pi is wrong. Use Tau...it's easier than Pi!
    • @UCu_9qD95nADzc-W6RN-3Z8A
    • 113/11328
    • View Profile
  • Gender: Male
Re: Today Is The Day After Doomsday
« Reply #9 on: December 21, 2015, 06:40:50 am »
Cool ;), and pun intended?! :P
Pun not intended. It was Julian accident ;)

Thought you guys were talking about the December 21 2012 doomsday scare...

As I said in the beginning of the post, it's not that kind of Doomsday :P The timing almost couldn't have been more perfect, though, in hindsight. The Doomsday on December 19 isn't too far off from December 21...hmmm :-|

Offline Juju

  • aka Yuki Kagayaki aka J̵̭͕͇ù̞̭̝̯̦j̴̭̙̗͖͡ù͏͓̲̕
  • CodeWalrus Staff
  • Super User
  • Server Maintenance
  • Moderator
  • Forum Maintenance
  • Original 5
  • CodeWalrus Supporter
  • *
  • Join Date: Nov 2014
  • Location: Inside a walrus
  • Posts: 2666
  • Post Rating Ratio: +17/-1
  • Couch potato
    • jul.savard
    • juju2143
    • @juju2143
    • juju2143
    • @julosoft
    • juju-kun
    • /u/juju2143
    • juju2143
    • View Profile
    • Juju's shed
  • Gender: Female
  • WalriiPoints: 99999
Re: Today Is The Day After Doomsday
« Reply #10 on: December 21, 2015, 06:44:40 am »
Cool ;), and pun intended?! :P
Pun not intended. It was Julian accident ;)
Are you guys talking about me?
  • Calculators owned: TI-83+ (dead?), Casio Prizm (also dead???)

In the beginning there was walrii. In the end there will be walrii. All hail our supreme leader :walrii:

YUKI-CHAAAANNNN

Offline JWinslow23

  • Pi is wrong. Tau > Pi
  • Super User
  • CW 4x3 challenge - 2nd place
  • *
  • Join Date: May 2015
  • Location: Somewhere between 13 and Graham's Number
  • Posts: 699
  • Post Rating Ratio: +9/-1
  • Pi is wrong. Use Tau...it's easier than Pi!
    • @UCu_9qD95nADzc-W6RN-3Z8A
    • 113/11328
    • View Profile
  • Gender: Male
Re: Today Is The Day After Doomsday
« Reply #11 on: December 21, 2015, 06:46:48 am »
Cool ;), and pun intended?! :P
Pun not intended. It was Julian accident ;)
Are you guys talking about me?
Julian -> "truly an". That specific pun was intended. What, your real name is Julian?

In that case, I have some exciting news...there's an obsolete calendar system named after you! :P

Offline Juju

  • aka Yuki Kagayaki aka J̵̭͕͇ù̞̭̝̯̦j̴̭̙̗͖͡ù͏͓̲̕
  • CodeWalrus Staff
  • Super User
  • Server Maintenance
  • Moderator
  • Forum Maintenance
  • Original 5
  • CodeWalrus Supporter
  • *
  • Join Date: Nov 2014
  • Location: Inside a walrus
  • Posts: 2666
  • Post Rating Ratio: +17/-1
  • Couch potato
    • jul.savard
    • juju2143
    • @juju2143
    • juju2143
    • @julosoft
    • juju-kun
    • /u/juju2143
    • juju2143
    • View Profile
    • Juju's shed
  • Gender: Female
  • WalriiPoints: 99999
Re: Today Is The Day After Doomsday
« Reply #12 on: December 21, 2015, 06:50:39 am »
It's Julien, actually. Which is French for Julian, which is in turn English for Latin name Julius. A famous bearer of the name is Julius Caesar, for which the Julian calendar and the month of July has been named for.
  • Calculators owned: TI-83+ (dead?), Casio Prizm (also dead???)

In the beginning there was walrii. In the end there will be walrii. All hail our supreme leader :walrii:

YUKI-CHAAAANNNN

Offline JWinslow23

  • Pi is wrong. Tau > Pi
  • Super User
  • CW 4x3 challenge - 2nd place
  • *
  • Join Date: May 2015
  • Location: Somewhere between 13 and Graham's Number
  • Posts: 699
  • Post Rating Ratio: +9/-1
  • Pi is wrong. Use Tau...it's easier than Pi!
    • @UCu_9qD95nADzc-W6RN-3Z8A
    • 113/11328
    • View Profile
  • Gender: Male
Re: Today Is The Day After Doomsday
« Reply #13 on: December 21, 2015, 06:56:10 am »
It's Julien, actually. Which is French for Julian, which is in turn English for Latin name Julius. A famous bearer of the name is Julius Caesar, for which the Julian calendar and the month of July has been named for.
Oh. Your name is Julien. Now Juju makes sense :P

And I knew that Julius Caesar was the namesake of the calendar system and July. Just like August was named after Augustus Caesar. And September through December were named because they used to be the 7th through 10th months (and the names stuck :P ). I just like to have fun with people. :P

Online c4ooo

  • ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
  • Super User
  • CW Contest II Winner
  • *
  • Join Date: Aug 2015
  • Location: 127.0.0.1
  • Posts: 825
  • Post Rating Ratio: +7/-2
  • ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
    • View Profile
  • Gender: Male
Re: Today Is The Day After Doomsday
« Reply #14 on: December 21, 2015, 04:06:03 pm »
Welp, and there i was pronouncing Juju's name wrong :P
(since latin has no 'J' or 'K' Julius Caesar was spelled "Iulius Caesar" and pronounced 'Yulias Kayzar")
« Last Edit: December 21, 2015, 04:09:44 pm by c4ooo »
??? ??? ???

 


You can also use the following HTML or bulletin board code to share it on your page or forum signature!


Also do not forget to check our affiliates below.
Planet Casio TI-Planet Calc.news BroniesQC BosaikNet Velocity Games