FACTOID # 107: At least 9 out 10 Nigerians attend church regularly. Only 4 out of 10 Americans claim to do so.
 
 Home   Encyclopedia   Statistics   Countries A-Z   Flags   Maps   Education   Forum   FAQ   About 
 
WHAT'S NEW
RECENT ARTICLES
More Recent Articles »
 

SEARCH ALL

FACTS & STATISTICS    Advanced view

Search encyclopedia, statistics and forums:

 

 

(* = Graphable)

 

 


Encyclopedia > Doomsday algorithm

The Doomsday algorithm is a way of This article details a mathematical algorithm to calculate the day of the week for any particular date in the past or future. There are a number of other algorithms to do this, including, for example, the Doomsday Algorithm, but they are all variants of each other, simply using different rules... calculating the day of the week of a given date. It is perpetually accurate since the The Gregorian calendar is the calendar currently used in the Western world. A modification of the Julian calendar, it was first proposed by the Neapolitan doctor Aloysius Lilius, and was decreed by Pope Gregory XIII, for whom it was named, on February 24, 1582 (Note: The papal bull Inter gravissimas... Gregorian calendar moves in cycles of 400 A year is the time between two recurrences of an event related to the orbit of the Earth around the Sun. By extension, this can be applied to any planet: for example, a Martian year is a year on Mars. Seasonal year A seasonal year is the time between successive... years. It makes use of the fact that, in each year, certain dates are all on the same day of the week.


The Flowcharts are often used to represent algorithms. An algorithm (the word is derived from the name of the Persian mathematician Al-Khwarizmi), is a finite set of well-defined instructions for accomplishing some task which, given an initial state, will terminate in a corresponding recognizable end-state (contrast with heuristic... algorithm was invented by John Horton Conway (born December 26, 1937, Liverpool, England) is a prolific mathematician active in the theory of finite groups, knot theory, number theory, combinatorial game theory and coding theory. Among amateur mathematicians, he is perhaps most widely known for his combinatorial game theory and for the invention of the... John Horton Conway. It can be used for either the The Gregorian calendar is the calendar currently used in the Western world. A modification of the Julian calendar, it was first proposed by the Neapolitan doctor Aloysius Lilius, and was decreed by Pope Gregory XIII, for whom it was named, on February 24, 1582 (Note: The papal bull Inter gravissimas... Gregorian Calendar or the The Julian calendar was introduced by Julius Caesar in 46 BC, taking force in 45 BC or 709 ab urbe condita. It was chosen after consultation with the Alexandrian astronomer Sosigenes and was probably designed to approximate the tropical year, known at least since Hipparchus. It has a regular year... Julian Calendar, but note that Julian calendar Doomsdays usually occur on different days from the Gregorian calendar Doomsdays.

Contents

The algorithm

The algorithm has three steps, namely, finding the anchor day for the century, finding a year's doomsday, and finding the day of week of the day in question.


To find a century's anchor day, begin by finding the century which the date falls in. (For the purposes of this calculation, century years will be treated as though they fall in the century that follows, even though they technically fall in the same century as the years before them. 2000 is a leap year starting on Saturday of the Gregorian calendar. Popular culture also holds the year 2000 as the first year of the 21st century and the 3rd millenium. By strict interpretation of the Gregorian Calendar, however, this distinction falls to the year 2001. The year 2000 is... 2000 is therefore part of the (20th century - 21st century - 22nd century - other centuries) Definition In calendars based on the Christian Era or Common Era, such as the Gregorian calendar, the 21st century is the current century, as of this writing, lasting from 2001-2100. The 21st century is the first century of the 3rd millennium... twenty-first century, not the (19th century - 20th century - 21st century - more centuries) Decades: 1900s 1910s 1920s 1930s 1940s 1950s 1960s 1970s 1980s 1990s The 20th century lasted from 1901 to 2000 in the Gregorian calendar (often from (1900 to 1999 in common usage). Sometimes it is known as the nineteen hundreds (1900s), referring to... twentieth century.) A year's century number is equal to its first two digits plus one (so 1966 is in the twentieth century). Take the century number and multiply by 5. Separately, take the integral part of the quotient when the century number minus one is divided by four. Add these two numbers (the product of the multiplication and the integral of the division). Taking the remainder mod 7 is often done at this point to make the numbers more manageable, since it won't affect the result. Now count forward that number of days from Thursday is the day of the week between Wednesday and Friday. The name Thursday comes from the Old English Þunresdæg, meaning the day of Þunor, commonly known in Modern English as Thor. By some conventions (see ISO 8601), the Thursdays of a year determine the week... Thursday to get the anchor day for the century. For example, the calculation for the twentieth century is: multiply the century number 20 by 5 to get 100; subtract 1 from the century number and then divide by 4 to get 4; sum 100 and 4 to get 104; find the remainder mod 7 to get 6; count 6 days on from Thursday for the answer, Wednesday.


Next, one must find the year's Doomsday. To accomplish that according to Conway, begin by taking the integral part of the quotient when the last two digits are divided by 12. Next, determine the remainder of this first quotient. After that, take the integral part of this number when it is divided by 4. Finally, determine the sum of the three numbers.


Now count forward the specified number of days from the anchor day (again taking remainder mod 7 can be done) to get the year's Doomsday.


The following days all occur on Doomsday for any given Gregorian year:

  • January 31 is the 31st day of the year in the Gregorian Calendar. There are 334 days remaining, (335 in leap years). Also, this is the final day of January. Events 1504 - France cedes Naples to Aragon. 1606 - Gunpowder Plot: Guy Fawkes is executed for his plotting against Parliament and... January 31 (or " In the Doomsday algorithm, January 32 is a code name for February 1, used to make computation of January dates easier. Categories: Days ... January 32", ie February 1 is the 32nd day of the year in the Gregorian Calendar. There are 333 days remaining, (334 in leap years). Events 1662 - The Chinese pirate Koxinga seizes the island of Taiwan after a nine-month siege. 1713 - The Kalabalik or Tumult in Bendery results from the Ottoman sultan... February 1, in A leap year (or intercalary year) is a year containing an extra day or month in order to keep the calendar year in sync with an astronomical or seasonal year. Seasons and astronomical events do not repeat at an exact number of days, so a calendar which had the same... leap years)
  • February 28 is the 59th day of the year in the Gregorian Calendar. There are 306 days remaining, 307 in leap years. Events 364 - Valentinian I is elevated as Roman Emperor. 1258 - Hulagu Khan sacks Baghdad 1700 - February 28 is followed by March 1 in Sweden, thus creating the Swedish... February 28 (or February 29 is the 60th day of a leap year in the Gregorian Calendar, with 306 days remaining. A year which has a February 29 is, by definition, a leap year. This date only occurs approximately every four years, in years evenly divisible by 4, such as 1992, 1996, or... February 29 if it's a leap year)
  • " In the Doomsday algorithm, March 0 is a code name for the last day of February, used to make computation of March dates easier. ... March 0" (a backwards extension of the calendar, equivalent to the last day of February.)
  • April 4 is the 94th day of the year in the Gregorian calendar (95th in leap years). There are 271 days remaining. Events 1581 - Francis Drake completes a circumnavigation of the world and is knighted by Elizabeth I. 1721 - Sir Robert Walpole enters office as the first Prime Minister of... April 4
  • May 9 is the 129th day of the year in the Gregorian Calendar (130th in leap years). There are 236 days remaining. Events 1300-1899 328 - Athanasius elected bishop of Alexandria. 1092 - Lincoln Cathedral is consecrated. 1429 - Joan of Arc defeats the English troops besieging Orléans. 1502 - Christopher Columbus... May 9
  • June 6 is the 157th day of the year in the Gregorian calendar (158th in leap years), with 208 days remaining. Events 1508 - Maximilian I, Holy Roman Emperor is defeated in Friulia by Venetian forces; he is forced to sign a three year truce and cede several territories to Venice... June 6
  • July 11 is the 192nd day (193rd in leap years) of the year in the Gregorian Calendar, with 173 days remaining. Events up to 18th century 1302 - Battle of the Golden Spurs (Guldensporenslag in Dutch) - the Flemish cities beat the king of France. 1346 - Charles IV of Luxembourg elected emperor... July 11
  • August 8 is the 220th day of the year in the Gregorian Calendar (221st in leap years), with 145 days remaining. Events 1585 - John Davis enters Cumberland Sound in quest for the North West Passage. 1588 - Battle of Gravelines ends - Defeated by the English during an invasion attempt, the surviving... August 8
  • September 5 is the 248th day of the year (249th in leap years). There are 117 days remaining. Events 1666 - Great Fire of London ended: A large fire in London burns out after three days. 10,000 buildings including St. Pauls Cathedral were destroyed, but only 16 people are... September 5
  • October 10 is the 283rd day of the year (284th in Leap years). There are 82 days remaining. Events 600-1899 680 - Battle of Karbala: Shia Imam Husayn bin Ali, the grandson of the Prophet Muhammad, was decapitated by forces under Caliph Yazid I. This is commemorated by Shia... October 10
  • November 7 is the 311th day of the year (312th in leap years) in the Gregorian Calendar, with 54 days remaining. Events 1665 - The London Gazette, the oldest surviving journal, is first published. 1783 - A man convicted of forgery is the last to be publicly hanged at Londons Tyburn... November 7
  • December 12 is the 346th day (347th in leap years) of the year in the Gregorian calendar. There are 19 days remaining. Events 627 - Battle of Nineveh 1531 - Apparition of Our Lady of Guadalupe, Mexico City 1719 - The first U.S. newspaper (the Boston Gazette) is published 1781 - The British... December 12

The dates listed above were chosen to be easy to remember; the ones for even months are simply doubles, 4/4, 6/6, 8/8, 10/10, and 12/12. Four of the odd month dates (5/9, 9/5, 7/11, and 11/7) are based on the phrase "I work from 9 to 5 at the 7-Eleven is an international conglomerate which operates the largest chain of convenience stores in twenty countries including: the United States, Canada, Norway, Sweden, Denmark, Japan, Australia, Taiwan, China, Hong Kong, Malaysia, Thailand, and Singapore. The company was founded in Oak Cliff, Texas, a suburb of Dallas, in 1927, and... 7-11."


For dates in March, March 7 is the 66th day of the year in the Gregorian Calendar (67th in Leap years). There are 299 days remaining. Events up to 19th century 1798 - The French army enters in Rome: the birth of the Roman Republic 1799 - Napoleon I of France captures Jaffa in Palestine and... March 7 falls on Doomsday, but the pseudodate "March 0" is easier to remember, as it is necessarily the same as the last day of February. Similarly, in leap years the pseudodate "January 32" is easier to remember than January 4 is the 4th day of the year in the Gregorian Calendar. There are 361 days remaining (362 in leap years). Events 871 - Battle of Reading - Ethelred of Wessex fights a Danish invasion army . 1493 - Christopher Columbus leaves the New World, ending his first journey . 1642 - English Civil War... January 4, as it is necessarily the same as February 1 is the 32nd day of the year in the Gregorian Calendar. There are 333 days remaining, (334 in leap years). Events 1662 - The Chinese pirate Koxinga seizes the island of Taiwan after a nine-month siege. 1713 - The Kalabalik or Tumult in Bendery results from the Ottoman sultan... February 1.


Therefore, if you know what day of the week Doomsday — the last day in February — is for a given year, you can easily determine the day of the week for any other date in that year, by finding the nearest Doomsday.


In code

The following is the algorithm in The C Programming Language, Brian Kernighan and Dennis Ritchie, the original edition that served for many years as an informal specification of the language The C programming language is a low-level standardized programming language developed in the early 1970s by Ken Thompson and Dennis Ritchie for use on the... C. Please note that division in C (using the / operator) is integer division and that the % operator is the In computing, the modulo operation finds the remainder of division of one number by another. When given two numbers, a and n, a modulo n is the remainder, r, on division of a by n. Although typically performed with a and n both being integers, many computing systems allow other... modulo operator.


Set "year" to whatever year (this case is 2005) computation is desired and the numeric values of the days of the week are:

0 – Sunday
1 – Monday
2 – Tuesday
3 – Wednesday
4 – Thursday
5 – Friday
6 – Saturday
 // Determine the archer day for the century year = 2005; century = year/100 + 1; a = century * 5; b = (century - 1) / 4; c = a + b; anchor = (c + 4) % 7; // Determine the Doomsday for the year in question e = (year % 100)/12; f = (year % 100)%12; g = f/4; h = e + f + g; dday = (h + anchor) % 7; 

"anchor" is the anchor day for the century and "dday" is the doomsday for the year. If "dday" is found to be Monday, then January 3 (or 4th), February 28 (or 29th), March 0, April 4, May 9, etc. (see above). To find the day of the date in question, determine the number of days away from the doomsday for that month and add it to "dday" modulo 7.


Examples

Example 1 (this year)

Suppose you want to know which day of the week Joseph and Mary with baby Jesus, at the first Christmas Christmas (literally, the Mass of Christ) is a holiday in the Christian calendar, usually observed on December 25, which celebrates the birth of Jesus. According to the Christian gospels, Jesus was born to Mary in Bethlehem, where she and her... Christmas Day of 2005 is a common year starting on Saturday of the Gregorian calendar. Events January Iraqi police officers hold up their index fingers marked with purple indelible ink, a security measure to prevent double voting. Worldwide aid effort continues to develop in response to the 2004 Indian Ocean earthquake. January 3... 2005 is. In the year 2005, Doomsday is Monday is the day of the week between Sunday and Tuesday. It gets its name from the Mona, the Saxon Moon god. Monday is sometimes held to be the first day of the week. This is the case in most of Europe and South America. In Asia, many languages refer... Monday. (The century's anchor day is 110 days after Thursday, or Tuesday is the day of the week between Monday and Wednesday. The English and Scandinavian names are derived from the Nordic god Tyr (in Old English, Tiw, Tew or Tiu. In Swedish, Tisdag, Danish: Tirsdag, Finnish: Tiistai). Quakers traditionally refer to Tuesday as Third Day eschewing the pagan origin of... Tuesday, and 2005's Doomsday is six days beyond.) This means that December 12 is a Monday. December 25 is the 359th day of the year (360th in leap years) in the Gregorian Calendar, with 6 days remaining. It is the 300th day counting from March 1, every year. Events 800 - Coronation of Charlemagne as Holy Roman Emperor, in Rome. 1066 - Coronation of William the Conqueror as... December 25, being thirteen days afterwards, falls on a Sunday is the day of the week between Saturday and Monday, and the second day of the weekend in some cultures. It is considered a holiday in lands of Christian tradition, the day Christians most commonly attend church. In the Gregorian calendar, no century can start on a Sunday. In... Sunday.


Example 2 (other years of this century)

Suppose that you want to find the day of week that the September 11 is the 254th day of the year (255th in leap years). There are 111 days remaining. It is usually the first day of the Coptic calendar (in the period 1900 to 2099 A.D.). The terms September 11 and 9/11 have been widely used in the Western... September 11, 2001 is a common year starting on Monday of the Gregorian calendar. By strict interpretation of the Gregorian Calendar, 2001 is also the first year of the 21st century and the 3rd millenium. Popular culture, however, often views the year 2000 as holding this distinction. 2001 is also the year... 2001 The World Trade Center on fire The September 11, 2001 attacks were a series of coordinated terrorist attacks against the United States on September 11, 2001. Nineteen members of al-Qaida, a militant Islamist group, hijacked four commercial aircraft. They crashed one into each tower of the World Trade Center... attacks on the World trade centers arose in the United States and Japan in the 1970s, spearheaded by New York Citys World Trade Center. A world trade center puts together under one roof all the services associated with global commerce, a kind of shopping mall providing networking access between corporations and governments... World Trade Center occurred. The anchor is Tuesday, and one day beyond is Wednesday is the day of the week between Tuesday and Thursday. The name comes from the Old English Wódnesdæg meaning the day of Woden, commonly known as Odin in Modern English. The astrological sign of the planet Mercury represents Wednesday, which was Dies Mercurii to the... Wednesday. September 5 is a Doomsday, and September 11, six days later, falls on a Tuesday.


Example 3 (other centuries)

Suppose that you want to find the day of week that the A civil war is a war in which the competing parties are segments of the same country or empire. Civil war is usually a high intensity stage in an unresolved political struggle for national control of state power. As in any war, the conflict may be over other matters such... Civil War broke out at Before the attack Map detailing the location of Fort Sumter Fort Sumter, located in Charleston, South Carolina harbor, was named after General Thomas Sumter. However, the fort is perhaps best known as the site where, according to tradition, the first shots of the United States Civil War were fired. In... Fort Sumter, which was April 12 is the 102nd day of the year in the Gregorian calendar (103rd in leap years). There are 263 days remaining. Events 467 - Anthemius is elevated to Emperor of the Western Roman Empire 1606 - The Union Flag is adopted as the national flag of Great Britain. 1633 - The formal... April 12, 1861 is a common year starting on Tuesday. Events January January 1 - Benito Juárez captures Mexico City January 2 - Friedrich Wilhelm IV of Prussia dies and is succeeded by Wilhelm I January 3 - American Civil War: Delaware votes not to secede from the United States January 9 - Mississippi... 1861. The anchor day is 99 days after Thursday, or Friday is the day of the week between Thursday and Saturday. Its name is derived from the goddess Frige of Germanic mythology. In most areas with a five-day working week, Friday is the last workday before the weekend and is therefore viewed as a cause for celebration or relief... Friday. The digits 61 give a displacement of six days, so Doomsday was Thursday. Therefore, April 4 was Thursday, so April 12, eight days later, is a Friday.


External links


  Results from FactBites:
 
Doomsday rule - Wikipedia, the free encyclopedia (1468 words)
The algorithm for mental calculation was invented by John Conway.
Doomsday is directly related to weekdays of dates in the period from March through February of the next year.
Doomsday is related to the dominical letter of the year as follows.
  More results at FactBites »


 

COMMENTARY     


Share your thoughts, questions and commentary here
Your name
Your comments
Please enter the 5-letter protection code

Want to know more?
Search encyclopedia, statistics and forums:

 


Lesson Plans | Student Area | Student FAQ | Reviews | Press Releases |  Feeds | Contact
The Wikipedia article included on this page is licensed under the GFDL.
Images may be subject to relevant owners' copyright.
All other elements are (c) copyright NationMaster.com 2003-5. All Rights Reserved.
Usage implies agreement with terms.