Live data from Hacker News

Lewis Carroll – computing the day of the week for any given date (1887)

futilitycloset.com

21–30 of 109 posts

Re: Lewis Carroll – computing the day of the week for any given date (1887)

#21
It's really interesting watching Art Benjamin do this in his TED talk[0] ... if you watch closely you can see him keeping track of the intermediate calculations in his hand movements.

Very clever, and obvious once you know.

[0] https://www.ted.com/talks/arthur_benjamin_a_performance_of_m... ... starts at 7:47

Re: Lewis Carroll – computing the day of the week for any given date (1887)

#22
To people who say that notation doesn't matter, this is what all mathematics was like before we got our new better notation.

I'd go as far as saying that in mathematics little other than notation matters and the same is true in computer science.

This is why lisp like languages are the obvious choice when variables are explicit.

Re: Lewis Carroll – computing the day of the week for any given date (1887)

#23

Earlier quoted context omitted.

A little pressed with time, but does it handle leap years properly? Since every year divisible by 100 is not a leap year, unless it is also divisible by 400? (E.g. 1900 is not a leap year but 2000 is)

There is a small correction needed for January and February in leap years, and I haven't included the corrections for pre-1900. The Carroll method does deal with these issues and I have internalised them, but I find I never use them, so I retain only the simpler version.

One simple way to do January and February is to treat them as part of the previous year (with an adjustment for the constant you remember for those months).

Re: Lewis Carroll – computing the day of the week for any given date (1887)

#24

Reading the article, I wandered into the difference of Old Style and New Style dates and what happened in 1752. From [1]: By the 18th century, the English legal year – used for legal, financial and other civil purposes – had for centuries begun on 25 March, or Lady Day.[13][i] Thus, for example, 24 March 1707 was immediately followed by 25 March 1708, while the day following 31 December 1708 was 1 January 1708, with…

Yes, I have been following Pepys (17th century) and the dates confused me a lot until I got the hang of it.

Re: Lewis Carroll – computing the day of the week for any given date (1887)

#25
So Lewis Carroll's method for today (May 24 2024):

The Century-Item:

The year is 2024. The century is 20.

20/4 = 5, with no remainder. Overplus is 0. 3-0 = 3. 3x2 = 6.

The Year-Item:

The year part is 24. Number of dozens: 2

24/12=2. Overplus: 24 mod 12 = 0. Number of 4's in the overplus: 0. 2+0+0 = 2.

The Month-Item: May: 1 (from the text).

The Day-Item: The day is 24.

Adding all items:

6+2+1+24=33. 33 mod 7 = 5, which is Friday.

Re: Lewis Carroll – computing the day of the week for any given date (1887)

#27

Earlier quoted context omitted.

> which I have swutch to That's a past participle I've never seent before

Second guessed myself and had to look up whether this was actually a word

If it was phrased 'to which I have swutch' I don't think I'd bat an eyelid!

(i.e. past perfect, I think?)

Re: Lewis Carroll – computing the day of the week for any given date (1887)

#29

Earlier quoted context omitted.

> which I have swutch to That's a past participle I've never seent before

Second guessed myself and had to look up whether this was actually a word

Google says the correct term is, in fact, Nintendo Switch.

Re: Lewis Carroll – computing the day of the week for any given date (1887)

#30
Carroll's algorithm has evolved over the years. The First Sunday Doomsday Algorithm (https://firstsundaydoomsday.blogspot.com/2009/12/quick-start...) includes all the improvements published as of 2023, including Fong & Walters' nifty "odd+11" rule for calculating the year code (https://arxiv.org/abs/1010.0765).
Post reply on HN