This mathematical trick will let you work out the weekday of any date H. Armstrong Roberts/ClassicStock/Alamy
Time comes in cycles, and we deal with it using a cyclic number system. What time is 5 hours after 10pm? Hopefully you would say 3am, not 15pm. You know 10 + 5 isn’t 3, but you also know to reset to zero when you hit 12. In mathematical terms, this is called modular arithmetic: we divide 15 by 12 and keep the remainder. We write this as 10 + 5 = 3 modulo 12.
Modular arithmetic has many applications, from cryptography to magic tricks. There is a trick you can learn where you ask someone to name a date this year and respond with the weekday. Imagine they say 4 January 2025. To the number 4 we will add 2, because this month started on a Wednesday, so we missed two weekdays at the start of the year. 4 + 2 = 6, so this date is the sixth day of the week, Saturday.
Later dates in January need a little more work. For example, the 16th gives 16 + 2 = 18. There isn’t an 18th day of the week, so we calculate this modulo 7, which means we divide by 7 and use the remainder. 16 + 2 = 4 modulo 7, so 16 January is a Thursday.
We can calculate the weekday of a date in 2025 by adding the day + 2 to the month number from the table below. Let’s pick a date at random: 19 May. The month number for May is 1, so we work out 19 + 2 + 1 = 1 modulo 7, so 19 May 2025 is a Monday.
The trick is remembering the table of month numbers, or working them out quickly. On 31 March 1887 (a Thursday), Lewis Carroll published a neat shortcut for these: if a month starts or ends with a vowel, use 10 minus the calendar number of the month. For example, for April, the fourth month, we use 10 – 4 = 6, so the month number for April is 6. It is a fun coincidence that this works for April, June, August and October.
We can get the number for the month after each of these by adding 2 if it is following a 30-day month or adding 3 if it is 31 days. So we only need to remember January is 0, February and March are 3 and December is 5.
For dates in 2025, we added 2 to the day. In 2026, we will add 3, because 2026 starts on a Thursday. This pattern shifts by 1 a year, or 2 if it is a leap year. This makes the number we add for the year tricky to calculate. Carroll’s solution was to work with the last two digits of the year: add to 6 the number of times this number divides by 12, the remainder and the number of times the remainder divides by 4.
For 2030, for instance, we find that 30 can be divided by 12 twice, with a remainder of 6, which can be divided by 4 once. 6 + 2 + 6 + 1 = 15, or 1 modulo 7, so we add 1 to dates that year. In a leap year, we deduct 1 for dates before March. Dates in the 1900s happened one weekday later than in the 2000s, so add 1 for years starting 19.
Carroll said he could do this trick in 20 seconds. Try it on your friends and family and see if you can beat him!
What you need
January 0
February 3
March 3
April 6
May 1
June 4
July 6
August 2
September 5
October 0
November 3
December 5
Peter Rowlett is a mathematics lecturer, podcaster and author based at Sheffield Hallam University in the UK. Follow him @peterrowlett
For other projects visit newscientist.com/maker
Topics:



