December 26, 1937... was a Sunday.

It was also the birthday of a mathematician named John H. Conway.

Conway has spent most of his life obsessed with games, from backgammon to his famous Game of Life... a machine that follows simple rules, but can evolve incredible complexity.

And he can also tell you the day of the week for any date, past or future, in a couple seconds.

Conway is smart, but he hasn't memorized 1000s of years of calendars.

He figured out how to answer this complex question with a simple set of rules.

He invented... an algorithm.

And after watching this video-and with a little bit of practice-you'll be able to do it too... all with just one hand.

Gimme a date!

Here's how it works: First let's give every day of the week a number.

Here's an easy way to remember 'em: NONEday, ONEday, TWOsday, THREEsday, FOURsday, FIVEday, SIXturday.

We'll use this in a sec.

Next, Conway realized in any given year, specific dates always share the same day of the week.

April 4, always the same weekday as October 10.

We can make another easy list: For even numbered months, it's the same date as the month, unless it's February, when it's the last day of the month.

The odd months are a little less obvious, but just remember "I'm working 9 to 5 at the 7-11" and you're almost there.

All that's left is Pi Day, and January, which is the 3rd, unless it's the 4th in a leap year.

And now we've got our list: a set of dates that are the same day, one every month.

These are what Conway called Doomsdays.

Scary name, but relatively easy to memorize.

And since weekdays repeat by 7s, we have a reference for any day of the year.

2018's Doomsdays are all Wednesdays.

Most years, the weekday for a date moves forward one day.

So in 2019 Doomsdays will be Thursdays.

But 2020's a leap year, and weekdays jump by two.

This is getting confusing.

We need to find our Doomsday a different way.

Start with the first year of the century.

2000's Doomsday was Tuesday.

Let's hold that number (2) here, on our index finger.

To find the Doomsday for any other year in a century was Conway's stroke of genius.

2057.

First, figure out how many times 12 goes into the year, 4, and hold that number here.

Put the remainder, 9, here.

Finally, how many times does 4 go into the remainder?

2.

Put it on your pinky.

Add these four numbers.

If the number's more than 6, divide 7 into it as many times as you can, and what's left over?

Seven and Seven and... three.

Wednesday's the Doomsday for that year.

For a different century, we just need to change the index number, or century day.

1900?

Wednesday.

1800, Friday.

And 2100's Doomsday will be Sunday.

Since our calendar, the Gregorian calendar, repeats every 400 years, we can figure out any other century, just by remembering these .

Now we have all we need to figure out the Doomsday for any year, and once we know that, we can figure out any other day that year.

Let's try.

EXAMPLES: What day was the Declaration of Independence signed?

Just like 2100, the century code is 0.

76 is 6 twelves, remainder 4, and there's 1 four in the remainder.

0 + 6 + 4 + 1 is 7 and 4.

The Doomsday for 1776 was a Thursday, and since 7/11 is a Doomsday, so is 7/4.

The first moon landing?

The century code is 3.

'69 is 5 twelves, remainder 9, which is 2 fours.

July 20 is 2 days after a Doomsday, put it on your thumb, so 2 + 3 + 5 + 9 + 2 is... 7 and 7 and 7 and 0.

It was a NONEday.

Kate McKinnon's birthday's January 6, 1984.

3, 7, no remainder, and since it's a leap year * *, 2 days after the Doomsday.

If you ever meet her, you can tell her she was born on a Friday.

Congrats, you just performed an algorithm.

Algorithms are a set of instructions for solving a problem step by step.

We know them best from computers.

But we run algorithms too, all the time.

In fact, the word "algorithm" comes from a Persian mathematician who wrote a book for doing math by hand... the same book that gave us "algebra".

We're interested in algorithms getting more than just the right answer.

We also want algorithms to do things efficiently.

Lewis Carroll, the author of Alice in Wonderland, and a mathematician, developed his own algorithm for solving the day of the week.

It was printed in Scientific American on June 18, 1887, a Saturday.

But Conway's is quicker.

These days, this kind of information is only a few clicks away, but it shows us how the right algorithms can extract answers from even complex data, and how, with a little bit of practice, you can be as smart as a computer.

At least for one day.

Stay curious.