I’ve been wondering whether New Year’s Day is more likely to occur on a weekday or weekend day. I mean, on a day by day basis. In other words, is it more likely to occur on a Wednesday or Saturday?

You hopefully realize that since there are five weekdays and two weekend days that New Year’s Eve – or any other calendar event that occurs on a specific date – is over twice as likely to occur on a weekday, right? 🙂 You do raise a fascinating question about the consistency of our calendar, however, and how it shifts over time – since 365 days / 7 isn’t evenly divisible – year after year. In theory, the odds of an event happening on any given day of the week should be exactly even over a long enough period, but it turns out that isn’t true!

Before we go any further, however, we have to compensate for the switch from the Julian calendar to the Gregorian calendar that we use today. That happened way back in 1582. October 1582, to be specific. That means the first “January 1st” on the modern calendar occurred in 1583. And that day turned out to be a Tuesday, as it happens.

Figuring out this question calls for some programming, actually, so let’s dig into a Linux shell script that can solve the problem. It all revolves around a handy little command line utility called **cal** that lets you specify a month and year and get a simple calendar listed. Like this:

Simple enough, right? This is where it gets interesting, though: if you evaluate the date of the last day of the first week of the year (in the above example, it’s 5) you can calculate what day of the week the first day occurred. Why go through that hoop? Because it turns out to be easier programmatically to get that last date than one in the middle of the line.

To do this, we’re going to build a loop that goes through a lot of years – 1583-3000 – and simply tallies up the day of the week that Jan 1 occurs. That’s done in a Bash (Linux) shell script thusly:

year1=1583; yearN=3000

for (( year=$year1; year <= $yearN; year++));

do

*some code goes here*

done

Fairly straightforward: Start by setting the year to $year1, which is 1583, then keep looping and incrementing by one until we hit $yearN.

The question is: what happens in the middle? There are three steps required to figure out the day of the week for a given calendar. First, isolate just the first week of the calendar, which can be done either by simply extracting line two, or identifying the line that has “1” by itself. I opt for the latter because it’ll work even if the cal output might change. In Linux scripting terms, it looks like this:

Once that line’s extracted, we *reverse it* with the rev command so what was the last digit on the line becomes the first, then use **cut** to extract it:

Now if we know the numeric day of Saturday of the first week of the new year, we can easily figure out which day the 1st was on. So let’s tally it up!

1 ) (( sat += 1 )); day=”Saturday”; ;;

2 ) (( fri += 1 )); day=”Friday”; ;;

3 ) (( thu += 1 )); day=”Thursday”; ;;

4 ) (( wed += 1 )); day=”Wednesday”; ;;

5 ) (( tue += 1 )); day=”Tuesday”; ;;

6 ) (( mon += 1 )); day=”Monday”; ;;

7 ) (( sun += 1 )); day=”Sunday”; ;;

esac

That’s all the work, believe it or not. Remember, if the last day of the first week is a 5, for example (as shown earlier), then the 1st must be on a Tuesday, so the code increments the variable “tue” one as appropriate.

If we run this script up thru 2020, it reports this:

That’s quite interesting results, actually. Saturday was the least common day for a New Year’s Day to occur on (60 times out of 438 years), while Tuesday proved the most common, occurring 65 times. Why? Darn good question.

Let’s run the test one more time, going all the way from 1583 to 3000. Surprisingly, the day by day results are the same:

Interesting, isn’t it? And now you know. As to why that proves to be the case, I’ll leave that for you to figure out!

It’s probably due to February having only every four years an extra day that screws with Tuesdays.