Darwin, pancakes and birthdays

I was browsing Twitter yesterday, and I happened to see a fun tweet about Darwin.

It's Darwin's birthday apparently. Do you think he was ever like "can I have a birthday cake?" and everyone else was like NO ONLY PANCAKES.

I quite like the idea of this, but I was a bit dubious about the plausibility. The tradition of pancakes on Shrove Tuesday is fairly well established, with pancake races dating back to at least 1445, so we can be reasonably sure that Darwin was at least familiar with eating pancakes on the day.

Birthday cakes are a little fuzzier. The earliest reference to a birthday cake that I could find was in Germany, 1746, and there really aren’t many mentions of cakes in Europe before 1850. Since Darwin was born in 1809, I don’t know how many birthday cakes he would actually have had. Poor Darwin.

But that wasn’t what piqued my interest. Let’s suppose that Darwin definitely had pancakes and birthday cakes. As was correctly pointed out a few moments after the original tweet, Shrove Tuesday moves around every day with Easter. I wanted to know: did Darwin’s birthday ever overlap with Shrove Tuesday while he was alive?

This gave me an opportunity to do a bit of playing with the datetime library in Python. Nothing here is particularly complicated, but it was fun to write nonetheless.

First we need to calculate the date of Easter. At face value, this might seem quite hard, since Easter moves around based on the cycles of the Moon. As it turns out, there’s a really easy way to do this, called Butcher’s algorithm. This is very easy to implement in Python, which gives us a way to find Easter:

import datetime

def easter_date(year):
	a = year % 19
	b = year // 100
	c = year % 100
	d = b // 4
	e = b % 4
	f = (b + 8) // 25
	g = (b - f + 1) // 3
	h = (19 * a + b - d - g + 15) % 30
	i = c // 4
	k = c % 4
	l = (32 + 2 * e + 2 * i - h - k) % 7
	m = (a + 11 * h + 22 * l) // 451
	p = h + l - 7 * m + 114

	month = p // 31
	# Here 3=March, 4=April

	day = p % 31 + 1
	# Since dates count from zero

	return datetime.date(year,month,day)

Once we’ve found Easter, getting to Shrove Tuesday is easy: we just jump back 47 days, and datetime contains a handy timedelta function that does just that:

def shrove_tuesday_date(year):
	easter = easter_date(year)
	shrove = easter - datetime.timedelta(days=47)
	return shrove

Finally, a simple for loop is enough to go through and find the years in Darwin’s life when his birthday was coincident with Shrove Tuesday:

for i in range (1809,1883):
	if shrove_tuesday_date(i) == datetime.date(i,02,12):
		print i, i-1809

which returns the following:

1839 30
1850 41
1861 52

So Darwin might have gone without birthday cakes because of Pancake Day at most three times in his life.

Looking at the years above, we notice that they’re separated by eleven years each. It turns out, this isn’t entirely coincidence. Let’s look at a wider range of years. Butcher’s algorithm runs from the start of the Gregorian calendar (in 1543) until, well, indefinitely.

So we can easily reuse the function above to find lots of years where Shrove Tuesday fell (or will fall) on February 12th. Running from 1543 to 2500:

1619 1630 1641
1771 1782 1793
1839 1850 1861
1907 1918 1929
1991 2002 2013
2143 2154 2165
2211 2222 2233
2363 2374 2385

So we have lots of clusters of three cropping up. And in the two areas where it breaks, the differences between years are still the same (6 and 5). And since Easter and Shrove Tuesday are separated by 47 days every year, this means that Easter is moving in the same pattern.

There’s clearly a feature of the Gregorian calendar that causes it to fall out this way. If we looked at different dates, we’d probably find similar patterns. I’m not going to go into it here, because it probably takes quite a lot of work, but I’ve included a link in the further reading section on Easter intervals.

Date maths can be really hard, and this is just one example of that. It’s not at all obvious why this pattern should appear, simply by looking at the calendar. I find all the exceptions and special rules really interesting, and I want to learn more about this. Even writing this simple stuff was quite fun, and I’d like to do more of it in the future.

And after all that, we still don’t know if Darwin got his cake.

Further reading