John Conway s Doomsday Algorithm

Similar documents
DAILY QUESTIONS 28 TH JUNE 18 REASONING - CALENDAR

JANUARY MONDAY TUESDAY WEDNESDAY THURSDAY FRIDAY SATURDAY SUNDAY

Smalltalk 10/2/15. Dates. Brian Heinold

Determine the trend for time series data

Time Concepts Series. Calendars

Astrological Calendar. for Central Time

Motion to Review the Academic Calendar Passed by Admissions and Standards, September 24, 2009

Chapter 1 0+7= 1+6= 2+5= 3+4= 4+3= 5+2= 6+1= 7+0= How would you write five plus two equals seven?

Fall 2017 Student Calendar. August 2017 S M T W T F S

2019 Settlement Calendar for ASX Cash Market Products. ASX Settlement

Methods for Accelerating Conway's Doomsday Algorithm (part 1)

Published by ASX Settlement Pty Limited A.B.N Settlement Calendar for ASX Cash Market Products

Name: (This only happens every four years or does it?)

CIMA Professional

CIMA Professional

2017 Settlement Calendar for ASX Cash Market Products ASX SETTLEMENT

Astronomy = Timekeeping

CIMA Professional 2018

DOZENALS. A project promoting base 12 counting and measuring. Ideas and designs by DSA member (#342) and board member, Timothy F. Travis.

UNIT 14 Time and Timetables Activities

Mountain View Community Shuttle Monthly Operations Report

CIMA Professional 2018

STATISTICAL FORECASTING and SEASONALITY (M. E. Ippolito; )

Summary of Calendar Possibilities

Lightning Calculation

Some Excel Problems ELEMENTARY MATHEMATICS FOR BIOLOGISTS 2013

WHEN IS IT EVER GOING TO RAIN? Table of Average Annual Rainfall and Rainfall For Selected Arizona Cities

GREGORIAN CALENDAR. Abstract

Mathematical Magic. Abstract

Years, Calendars and Continued Fractions

one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen zero oneteen twoteen fiveteen tenteen

2017 Autumn Courses. Spanish Elementary. September - December Elementary 1 - A1.1 Complete beginner

Year 9 Science Work Rate Calendar Term

4.4 The Calendar program

The Perennial Ecliptic Calendar

Project Appraisal Guidelines

January 2009 Videmus Stellae

GAMINGRE 8/1/ of 7

When is the Holy Day?

PHSC 1053: Astronomy Time and Coordinates

Say Kids, What Time Is It?

ACCA Interactive Timetable & Fees

Before Reading. Practice. wave. east. west. A. Fill in the blanks using the word list. west east tired wave pull shines. The Lazy Moon.

SYSTEM BRIEF DAILY SUMMARY

Calculations Equation of Time. EQUATION OF TIME = apparent solar time - mean solar time

ACCA Interactive Timetable

Lunar Cycle. About This Lesson Phases of the Moon

Passover Days CE

Astronomy 291. Professor Bradley M. Peterson

Badí Pocket Planner 175 BE A Badí & Gregorian planner for the year Dál

SYSTEM BRIEF DAILY SUMMARY

The 2100-calendar. the ultimate, modern Gregorian calendar

Calendars and the uniform passage of time

YEAR 10 GENERAL MATHEMATICS 2017 STRAND: BIVARIATE DATA PART II CHAPTER 12 RESIDUAL ANALYSIS, LINEARITY AND TIME SERIES

ENGINE SERIAL NUMBERS

Changing Hydrology under a Changing Climate for a Coastal Plain Watershed

Why is it 20:00:00, Wednesday 2 nd November 2011?

ACCA Interactive Timetable

The Next Step. Mathematics Applications for Adults. Book Measurement

ACCA Interactive Timetable & Fees

ACCA Interactive Timetable

Time Series Analysis

ACCA Interactive Timetable & Fees

ACCA Interactive Timetable & Fees

ACCA Interactive Timetable & Fees

ACCA Interactive Timetable & Fees

ACCA Interactive Timetable & Fees

ACCA Interactive Timetable & Fees

ACCA Interactive Timetable

The Medieval Calendar

ACCA Interactive Timetable

ACCA Interactive Timetable & Fees

S2: Overview. Illustrated for 2017 Spring Calendar S2. Current Spring Calendar. First Class Day: Earliest: Jan 22 Latest: Jan 28

Label the lines below with S for the same meanings or D for different meanings.

Mathematics for Health and Physical Sciences

ACCA Interactive Timetable & Fees

One sine wave is 7.64 minutes peak to peak variation. Two sine waves is 9.86

Carnival in Venice Æon Figure 8 Calendar April March 2010

Champaign-Urbana 2000 Annual Weather Summary

CONTENTS Page Rounding 3 Addition 4 Subtraction 6 Multiplication 7 Division 10 Order of operations (BODMAS)

Section A Number Facts

Student Book SERIES. Time and Money. Name

How to find Sun's GHA using TABLE How to find Sun's Declination using TABLE 4...4

CHAPTER 1 EXPRESSIONS, EQUATIONS, FUNCTIONS (ORDER OF OPERATIONS AND PROPERTIES OF NUMBERS)

Time Series and Forecasting

ACCA Interactive Timetable

New Testament in a Year Daily Bible Reading Plan

ACCA Interactive Timetable

Astronomical Techniques I

ISO Lead Auditor Lean Six Sigma PMP Business Process Improvement Enterprise Risk Management IT Sales Training

(rev ) Important Dates Calendar FALL

'to facts in 1 min. (Reasonable amount of time)

Champaign-Urbana 2001 Annual Weather Summary

ACCA Interactive Timetable

ISO Lead Auditor Lean Six Sigma PMP Business Process Improvement Enterprise Risk Management IT Sales Training

PHAS 1511: Foundations of Astronomy

ACCA Interactive Timetable

ISO Lead Auditor Lean Six Sigma PMP Business Process Improvement Enterprise Risk Management IT Sales Training

Notes on Moon Calendar 1/21/2015

Appendix BAL Baltimore, Maryland 2003 Annual Report on Freeway Mobility and Reliability

Transcription:

1 The algorithm as a poem John Conway s Doomsday Algorithm John Conway introduced the Doomsday Algorithm with the following rhyme: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 The last of Feb., or of Jan. will do (Except that in Leap Years it s Jan. 32). Then for even months use the month s own day, And for odd ones add 4, or take it away. Now to work out your doomsday the orthodox way Three things you should add to the century day Dozens, remainder, and fours in the latter, (If you alter by sevens of course it won t matter) In Julian times, lackaday, lackaday Zero was Sunday, centuries fell back a day But Gregorian 4 hundreds are always Tues. And now centuries extra take us back twos. According to length or simply remember, you only subtract for September, or November. 1.1 The doomsday In other words, here is a simple trick that you can use to determine the day of the week for any date of the current year. (With just a little practice, you should be able to compute the day of the week in any year in your head using simple arithmetic.) The day of the week on which the last day of February falls is called the doomsday. For non-leap years (or common years), this date is February 28; for leap years, it is February 29. Since 2014 is a common year, the current doomsday is the day of the week on which Feb. 28, 2014 occurred: a Friday. Everything else that we need follows from one simple lemma: Lemma: Adding or subtracting any integer multiple of 7 to any date leaves the day of the week unchanged. 1 For example, February 7, 14, 21, and 28 all fall on the same day of the week. Likewise, adding x days is equivalent to adding x 7 days, which is equivalent to subtracting 7 x days. For example. with x = 6, the day of the week that falls 6 days after Monday, is the same as the one that is 7 6 = 1 day before. 1.2 The rule of January We now use the lemma to identify at least one date in every other month that falls on the same day of the week as the doomsday. We begin with the rule of January: In a common year (like 2013) February has 28 days. By applying the above lemma, we subtract 4 7 = 28 days from February 28 to arrive at February 0, which must also fall on the doomsday. But February 0 is just another name for January 31 as both dates immediately precede February 1. Thus in a common year, January 31 is the doomsday. In leap years, the doomsday is 1 An operation that leaves something important unchanged is called an invariant. Keep your eyes open for other invariants during the course. August 21, 2014 (11:23 AM) 1 Robert R. Snapp 2014

February 29. Again subtracting 28, a multiple of 7, yields February 29-28 = February 1. Thus in a leap year. February 1 falls on the doomsday. With a touch of whimsey, this date is also called January 32, as both dates immediately follow January 31. Thus in leap years January 32 is the doomsday. Alternatively, observe that 31 28 = 3, and 32 28 = 4. Thus January 3 always falls on the same day of the week as January 31; as January 4 does for February 1. Consequently, for common years (which come in groups of 3), the doomsday is January 3; and for leap years (which come once every 4 years) the doomsday is January 4. 1.3 The rule of March The rule of March uses of a similar trick. Since the doomsday immediately precedes March 1 (for both leap years and non-leap years), we call the last day of February March 0. Thus, for every year, March 0 is the doomsday. If you insist on using an actual date in March, the lemma implies that March 7, 14, 21, and 28 (any multiple of 7) are all doomsdays. 1.4 The rule of even months (after February) The third line of Conway s rhyme expresses the rule of even months (after February). Thus for April, the fourth month, the doomsday is on 4/4. For June it is 6/6; August, 8/8; October 10/10; and December, 12/12. How does this happen? The answer follows from the lemma and an interesting pattern within the seemingly irregular distribution 2 Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec 31 28 29 31 30 31 30 31 31 30 31 30 31 Conway observed that when eight of the months are paired as shown (April with May, June with July, August with September, and October with November), then together each pair contains exactly 30 + 31 = 61 days. Since adding 2 to 61 produces a multiple of 7, every doomsday in June occurs two dates after the corresponding doomsdays in April. 3 Likewise every doomsday in August occurs two dates after a doomsday in June; etc. So all we need to do is identify one doomsday in April the remainder of even months will fall like dominoes. Using the lemma with the rule of March we learn that March 35 is a doomsday. By now we 2 Our current calendar, the Gregorian calendar, is a slight refinement of the solar calendar that Julius Caesar introduced shortly before his assassination in 44 bc. Modern scholarship suggests that the number of days in each month has remained unchanged since Caesar imposed his calendar in 45 bc. Although Richards [3] acknowledges this dispute he suggests the days were distributed as follows: March (their first month), April, June, August (Sextilis), October, and December all had 30 days; May, July (Quintilis), September, November and January all had 31; and February (the last month) had 29 days, except every fourth year, when it had 30. Later, the Roman Senate thanked Caesar (after they had stabbed him to death), by naming Quintilis Julius (i.e., July) in his memory. Apparently though, they stabbed him too soon: instead of inserting leap years every four years, they applied them every three. (The Romans had a confusing convention of inter-counting. ) Consequently the Roman year gradually diverged from the solar year. Thus it was up to the next ruler, Emperor Augustus, to fix things up, which he did by suspending enough leap years until the calendar was back in sync with the Sun. Once this happened, leap years were resumed, but only once every four years as Caesar had intended, The Roman Senate was so grateful, that they named Sextilis after Augustus, and as (unreliable) legend has it, gave each month the number of days that they currently have so that August would be no shorter than July. In any event, the Julian calendar remained relatively unchanged until Pope Gregory XIII in 1582 ordered the elimination of ten days (eleven for late adopters) to put the calendar back in sync, and removed the future leap days from years that are evenly divisible by 100 but not by 400. 3 Some may prefer to use the word most instead of every in this sentence, as the doomsday in June that is 63 days after the last doomsday in April might actually be the first doomsday in July. However, if we allow ourselves to call these dates June 31 and June 32 when they occur, then all is well. August 21, 2014 (11:23 AM) 2 Robert R. Snapp 2014

are accustomed to such improper dates. But you should also know that there is an easy recipe to find the conventional name for a improper date. To convert March 35, we carry (just like in ordinary arithmetic) 31 days (the number of days in March) from the date column, and advance the month. Thus, March 35 = April (35 31) = April 4. Likewise doomsdays fall on June 4 + 2 = 6, August 6 + 2 = 8, October 8 + 2 = 10, and December 10 + 2 = 12, demonstrating the rule of even months. 1.5 The rule of odd months (after March) The fourth line and footnote in Conway s rhyme describe the rule of odd months (after February). Adding 4 to the index of every odd month (after February) having 31 days; and subtracting 4 from the index of those that have only 30 days, yield the remaining doomsdays: Mar 3 + 4 = Mar 7, or 3/7, May 5 + 4 = May 9, or 5/9, Jul 7 + 4 = Jul 11, or 7/11, Sep 9 4 = Sep 5, or 9/5, Nov 11 4 = Nov 7, or 11/7, Note that rule of odd months is consistent with the rule of March, and that for the remaining four months, 9 is paired with 5 (5/9 and 9/5), while 7 is always paired with 11 (7/11 and 11/7). You can thus use the mnemonic working 9 to 5 at the 7-Eleven, the latter being a national convenience store chain. The rationale for the rule of odd months follows for each odd month: From the rule of March and our lemma, March 7, is a doomsday, Thus, adding 4 to the index of March (3) yields the doomsday March 7 = 3/7. Next, we add 63 (a multiple of 7) to March 7, obtaining March 70. Carrying the months of March and April in succession, yields March 70 = April (70 31) = May (70 31 30) = May 9, or 5/9. Advancing another 63 days, yields the doomsday May 72. Again we carry two months, May 72 = June (72 31) = July (72 31 30) = July 11, or 7/11. It is left as an exercise for the reader to verify that 9/5 and 11/7 are doomsdays. See Table 1 for a summary of the doomsdays obtained for each month. Now that you know how to find a doomsday for every month of the current year, the rest of the exercise is solved by simple arithmetic. To find the day of the week for September 1, 2014, for example, first use the 9 to 5 rule to find a Friday in September [9/5], then either step back 5 1 = 4 days (Wednesday, Tuesday, Monday, Sunday) or step forward 7 4 = 3 days (Friday, Saturday, Sunday, again!). Remember you can freely add or subtract 7 to any date without changing the day of the week. You should practice this as much as you can. Also you can verify that the Fourth of July, Hallowe en, and Boxing Day (the day after Christmas Day) are always doomsdays. 2 Finding the doomsday in a future or past year The second stanza of Conway s poem describes how to find the doomsday for an arbitrary year. The basic fact to remember is that common years, like 2011, 2013, and 2014, have exactly 365 days. It is easy to verify that August 21, 2014 (11:23 AM) 3 Robert R. Snapp 2014

Doomsdays 3 or 31 Jan. { } Rule of January Jul. 11 Rule of odd months (7 + 4) 4 or 32 Feb. { 28 } 29 Basic definition Aug. 8 Rule of even months (8/8) Mar. 7 Rule of odd months (3 + 4) Sept. 5 Rule odd months (9 4) Apr. 4 Rule of even months (4/4) Oct. 10 Rule of even months (10/10) May. 9 Rule of odd months (5 + 4) Nov. 7 Rule of odd months (11 4) Jun. 6 Rule of even months (6/6) Dec. 12 Rule of even months (12/12) Table 1: A summary of the doomsday rules applied to each month of the year. For those dates appearing in curled braces, the upper value should be used in a non-leap year, and the lower, in a leap year. Year 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 Doomsday Mon. Tue. Wed. Thu. Sat. Sun. Mon. Tue. Thu. Fri. Sat. Sun. Year 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 Doomsday Tue. Wed. Thu. Fri. Sun. Mon. Tue. Wed. Fri. Sat. Sun. Mon. Year 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 Doomsday Wed. Thu. Fri. Sat. Mon. Tue. Wed. Thu. Sat. Sun. Mon. Tue. Table 2: The days of the week on which the doomsdays listed in Table 1 fall on. Leap years are identified in bold font. 365 = 7 52 + 1. Thus if the following year is a common year, then the doomsday advances by one day of the week. So in 2014 the last day of February, February 28, 2014, will fall on a Friday, and all of the dates shown in Table 1 will be Fridays in the year 2014. Likewise, if the current year is a common year, then the doomsday of the previous year retreats by one day of the week. Thus, the doomsday for 2012 (February 29, 2012) was a Wednesday. Leap years on the other hand have 366 = 7 52 + 2 days. Thus if the following year is a leap year, then its doomsday will advance by two days of the week. And if the current year is a leap year then the previous year s doomsday would be two days earlier in the week. Thus, the doomsday of 2011 was Wednesday 2 = Monday. The following table (in which leap years appear in bold typeface) illustrates this. Now you shouldn t attempt to memorize the table; just learn the pattern. 4 Leap years occur every four years (but not at the end of centuries like 1700, 1800, 1900, or 2100, unless divisible by 400, like 1600, 2000 and 2400). (Note that the summer olympic games, and U.S. presidential elections usually fall in a leap year.) 3 The twelve-year rule Also note any 12-year jump forward (up to the 99th year in a century) advances the doomsday by one day of the week for both leap or non-leap years. Actually, you don t need the table to figure this out. Every such 12 year period contains exactly 3 leap years, and therefore exactly 12 3 = 9 non-leap years. So moving forward by twelve years advances the doomsday by 3 2 + 9 1 = 15 days. Subtracting two sets of 7 (remember adding 4 The table also reveals a 28 year cycle, which equals the product of the number of days of the week, times the number of years between successive leap years. August 21, 2014 (11:23 AM) 4 Robert R. Snapp 2014

or subtracting 7 does not change the weekday) yields 15 14 = 1. So the day advances by 1, and thus the doomsday in 2026will fall on a Saturday. Going backwards by 12 results in a 1 day retreat, so the doomsday in 2014 12 = 2002 was Thursday. We ll call this the twelve-year rule. (Be careful though if you cross a century mark that is not divisible by 400: a 12 year jump forwards or backwards across a non-leap year century (like 1900) does not change the doomsday at all!) 4 Computing the doomsday for an arbitrary year To simplify computing the doomsday for years in different centuries, Conway s algorithm uses the last year of each century as a reference. It is not difficult to verify that the doomsdays for these years obey the following pattern, (see lines 11 and 12 in the poem): Gregorian Centuries by Doomsday Sunday Monday Tuesday Wednesday Thursday Friday Saturday 1700 1600 1500 2100 2000 1900 1800 2500 2400 2300 2200 Note that every Gregorian century mark divisible by 400 is a leap year, and has a doomsday of Tuesday. Furthermore, the doomsday retreats by two weekdays with every advancing (non-leap year) century. The ultimate short cut is expressed in the second stanza (lines 5 8). For July 4, 1776. Start with the century mark 1600; the doomsday is Tuesday. Moving forward to 1700, the doomsday falls back two days to Sunday. Now find the largest multiple of 12 that is less than or equal to 76 (that is 1776 1700). Clearly 76 = 12 6 + 4. So the doomsday advances 6 days, for the quotient, plus 4 days for the remainder, plus 1 more day because 1776 is in fact a leap year. Thus the doomsday of 1776 is Sunday plus 11 days, which by the lemma equals Sunday minus three days, or Thursday. Since July 4, is always a doomsday, July 4, 1776 was a Thursday. Sometimes you may see the notation 76/12 = 6, which means that the greatest integer contained in the quotient 76/12 = 6.333 is 6. The function x is called the floor of x. Likewise, we frequently represent the remainder by the mod, or modulus. Explicitly 76 mod 12 = 4. Consequently, the entire doomsday calculation for July 4, 1776 can be written as Sunday + 76/12 + 76 mod 12 + (76 mod 12)/4 = Sunday + 6 + 4 + 1 = Sunday + 11 = Thursday. Finally, for the Julian calendar (which was still used in English speaking countries and colonies up to 1750), the doomsdays retreated by one day every century. Take care with years bc, as there actually wasn t a year 0: the year before 1ad, was 1bc. Julian Centuries by Doomsday Sunday Monday Tuesday Wednesday Thursday Friday Saturday 0 700 600 500 400 300 200 100 1400 1300 1200 1100 1000 900 800 1700 1600 1500 August 21, 2014 (11:23 AM) 5 Robert R. Snapp 2014

Homework Exercises, Due Friday, September 5, 2014 1. Use the doomsday algorithm to find the day of the week for the following dates. Show your work, with as much detail as presented in the above example. (a) April 15, 2015 (the date your next federal income tax return is due). (b) November 11, 2011 (11/11/11). (c) July 14, 1789 (Bastille Day) (d) June 6, 1944 (the invasion of Normandy: D-Day). (e) June 28, 1914 (the assassination of Archduke Ferdinand of Austria that triggered the start of the first world war). (f) August 4, 1961 (Barack Obama s birthday). (g) January 1, 2014. (h) March 20, 1852, the publication date (in book form) of Harriet Beecher Stowe s, Uncle Tom s Cabin. 2. Thanksgiving Day in the United States is celebrated on the fourth Thursday in the month of November. What is the earliest date in November on which this holiday can occur? What is the latest date? Use the Doomsday Algorithm to determine the dates of Thanksgiving Day for 2012, 2013, and 2014. 3. This year (2014) the month of June had five Sundays, and five Mondays. Use the Doomsday Algorithm to determine the next year in which June will again have this property. 4. Use arithmetic to derive the doomsdays for the years 2000, 1900, 1800, 1700, and 1600. 5. (Optional.) Compute the doomsdays for the years in which your parents, grandparents, and other family members were born. Use the Doomsday Algorithm to determine the day of the week for each birth. For further reading If you are interested in learning more about the Doomsday Algorithm, please refer to Volume 4, of Berlekamp, Conway, and Guy s Winning Ways [1, pp. 903 906], or the article by Conway and Kochman [2]. Mapping Time, by Richards [3] provides a description of the development and uses of calendars in different cultures and eras. References [1] Elwyn R. Berlekamp, John H. Conway, and Richard K. Guy, Winning Ways for Your Mathematical Plays, Second Edition, Vol. 4, A. K. Peters, Wellesley, MA, 2004. [2] John H. Conway and Fred Kochman, Calendrical Conundrums, in David Wolfe and Tom Rogers, ed., Puzzlers Tribute: A Feast for the Mind, A. K. Peters, Wellesley, MA, 2002, pp. 191 204. [3] E. G. Richards, Mapping Time: The Calendar and Its History, Oxford University Press, Oxford, U. K., 1998. August 21, 2014 (11:23 AM) 6 Robert R. Snapp 2014