Skip to content
Vamshi Jandhyala

Books · The Fiddler: Solutions

Chapter 17

Can Every Day Be First?

In 20262026, every day of the week falls on the first of some month at least once. Is 20262026 special in this regard? If so, when is the next year in which one of the days of the week is not represented among the firsts of the months?

The Fiddler, Zach Wissner-Gross, February 27, 2026(original post)

Solution

It is not special at all: every year, common or leap, has all seven weekdays among its month-firsts, so the year asked for never arrives.

The weekday of each month’s first is fixed by the cumulative day-count since January 11, taken modulo 77. Those offsets do not depend on which weekday January 11 happens to be; that only shifts every first by the same constant. For a common year the twelve offsets are 0,3,3,6,1,4,6,2,5,0,3,5(mod7),0,\,3,\,3,\,6,\,1,\,4,\,6,\,2,\,5,\,0,\,3,\,5 \pmod 7, whose set is {0,1,2,3,4,5,6}\{0,1,2,3,4,5,6\}: all seven residues. A leap year also covers all seven. Since the offsets already cover every residue, adding the constant for January 11 still covers every weekday. So no year ever omits one: 2026 is not special, and no such “next year” exists.\boxed{\text{$2026$ is not special, and no such ``next year'' exists.}}

The computation

Two checks. First, the month-first offsets modulo 77 already hit all seven residues, in both a common and a leap year. Second, sweep eleven centuries of real calendars and confirm none omits a weekday among its twelve month-firsts.

import datetime
def residues(leap):
    L = [31, 29 if leap else 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
    off, s = 0, {0}
    for d in L[:-1]:
        off = (off + d) % 7; s.add(off)
    return sorted(s)
print(residues(False), residues(True))      # both = [0,1,2,3,4,5,6]
miss = [y for y in range(1900, 3001)
        if len({datetime.date(y, m, 1).weekday() for m in range(1, 13)}) < 7]
print(miss)                                  # []  -> never

Extra Credit

Imagine instead a hypothetical calendar with twelve months, each of length 2828 to 3131 days, and a year totalling 365365 or 366366 days. What is the fewest days of the week that can appear as the first of a month?

Solution

The real calendar manages all seven by accident; choosing month lengths adversarially we can collapse that to three, and no fewer. A month’s length modulo 77 is 0,1,2,30,1,2,3 for 28,29,30,3128,29,30,31 days, so consecutive firsts advance by 00 to 33 weekdays. Lengths 30,31,3030,31,30 repeated (advances 2,3,22,3,2, summing to 77 each cycle) send the firsts around 0,2,5,0,2,5,0,2,5,0,2,5,\dots, touching only three weekdays, while still totalling 365365. An exhaustive search over all twelve-month length assignments confirms three is the minimum for both 365365 and 366366: 3.\boxed{3}.

The computation

Enumerate every assignment of extra days (00 to 33 per month, i.e. lengths 2828 to 3131) to the first eleven months, fix December so the year totals 365365 or 366366, and track the set of weekday residues the firsts land on. The smallest such set has size three.

import numpy as np, itertools as it
E = np.array(list(it.product(range(4), repeat=11)))   # extra days, months 1..11
P = np.cumsum(E, axis=1); R = P % 7; T11 = P[:, -1]
for year in (365, 366):
    tgt = year - 12*28
    ok = (T11 >= tgt - 3) & (T11 <= tgt)              # December's extra in 0..3
    mask = np.ones(ok.sum(), int)                     # residue 0 (January) always present
    for c in range(11): mask |= (1 << R[ok][:, c])
    print(year, min(bin(m).count("1") for m in mask)) # 365 3 ; 366 3