0
0

Century Code & Day Formula (Zeller’s Rule)

Introduction

Century codes and day formulas (like Zeller’s Rule) let you compute the weekday for any Gregorian calendar date quickly and reliably. This pattern is important because it provides a formulaic, exam-friendly method that avoids long year-by-year counting and works well for dates across centuries.

Pattern: Century Code & Day Formula (Zeller’s Rule)

Pattern

The key idea: Convert the date into components (day, adjusted month, year-of-century and century), apply month and century codes plus the year's contribution and leap adjustments, sum them, and take modulo 7 to get the weekday.

We use Zeller’s congruence (Gregorian calendar) with months March = 3 … December = 12, and January/February treated as months 13/14 of the previous year.
Use the formula: h = ( q + floor(13*(m+1)/5) + K + floor(K/4) + floor(J/4) + 5*J ) mod 7
where:

  • q = day of month
  • m = month (3 = Mar, …, 12 = Dec; Jan = 13, Feb = 14 of previous year)
  • K = year of century (year % 100)
  • J = zero-based century (floor(year / 100))
  • h = 0 → Saturday, 1 → Sunday, 2 → Monday, … 6 → Friday

Step-by-Step Example

Question

What day of the week was 26 January 1950?

Solution

  1. Step 1: Adjust month and year for Zeller

    January is treated as month 13 of the previous year. So use: q = 26, m = 13, and year = 1949.
  2. Step 2: Compute K and J

    K = year % 100 = 1949 % 100 = 49.
    J = floor(year / 100) = floor(1949 / 100) = 19.
  3. Step 3: Evaluate the formula components

    • floor(13*(m+1)/5) = floor(13*(14)/5) = floor(182/5) = 36
    • floor(K/4) = floor(49/4) = 12
    • floor(J/4) = floor(19/4) = 4
    • 5*J = 5*19 = 95
    Now sum the terms: h = ( q + 36 + K + 12 + 4 + 95 ) mod 7 = (26 + 36 + 49 + 12 + 4 + 95) mod 7.
    Total = 222.
  4. Step 4: Reduce mod 7

    222 mod 7 = 5. According to Zeller’s mapping, h = 5 corresponds to Thursday (0 = Sat, 1 = Sun, 2 = Mon, 3 = Tue, 4 = Wed, 5 = Thu, 6 = Fri).
  5. Final Answer:

    26 January 1950 was a Thursday.
  6. Quick Check:

    Cross-check with an alternate odd-day method or historical calendar - both confirm Thursday. ✅

Quick Variations

1. Use Zeller’s with months mapped as Mar→3 … Jan→13, Feb→14 (and decrement year for Jan/Feb).

2. For faster head calculations you can precompute and memorize month codes and century codes, then use the simplified form: weekday = (day + month_code + year_code + century_code + leap_adjust) mod 7.

3. Tomohiko Sakamoto’s algorithm or the Doomsday rule are alternative methods that may be faster in mental calculation; pick the method you are most comfortable with.

4. Always verify the weekday mapping used by your formula (Zeller’s uses Saturday = 0).

Trick to Always Use

  • If month ≤ 2 (Jan/Feb), add 12 to month and subtract 1 from year before computing K and J.
  • Precompute floor(13*(m+1)/5) values (month offsets) for m = 3..14 to avoid repeated division.
  • Memorize century adjustments (values of 5*J and floor(J/4)) for common centuries to speed up calculations.
  • Reduce large intermediate sums modulo 7 early to keep arithmetic small and avoid mistakes.

Summary

Summary

  • Convert the date into q, adjusted m, K, and J. (For Jan/Feb use months 13/14 of the previous year.)
  • Apply Zeller’s formula: h = ( q + floor(13*(m+1)/5) + K + floor(K/4) + floor(J/4) + 5*J ) mod 7.
  • Interpret h as weekday with mapping 0 = Sat, 1 = Sun, …, 6 = Fri.
  • Use precomputed month/century codes and reduce modulo 7 often to simplify manual work.

Example to remember: 26 January 1950 → Thursday.

Practice

(1/5)
1. What day of the week was 1st January 2000?
easy
A. Saturday
B. Sunday
C. Friday
D. Monday

Solution

  1. Step 1: Adjust month/year for Zeller

    January → treat as month 13 of previous year. So use: q = 1, m = 13, year = 1999.
  2. Step 2: Compute K and J

    K = 1999 % 100 = 99, J = floor(1999 / 100) = 19.
  3. Step 3: Evaluate formula components

    floor(13*(m+1)/5) = floor(13*14/5) = 36;
    floor(K/4)=floor(99/4)=24;
    floor(J/4)=floor(19/4)=4;
    5*J = 95.
    Sum: h = (1 + 36 + 99 + 24 + 4 + 95) = 259259 mod 7 = 0.
  4. Step 4: Map result to weekday

    Zeller mapping: 0 → Saturday. So 1 Jan 2000 = Saturday.
  5. Final Answer:

    Saturday → Option A
  6. Quick Check:

    Known anchor: 1 Jan 2000 (Y2K) was Saturday ✅
Hint: For Jan/Feb treat them as months 13/14 of previous year; apply Zeller and map 0→Sat.
Common Mistakes: Forgetting to decrement year for Jan/Feb or mis-mapping Zeller's h value.
2. What day of the week was 15th August 1947?
easy
A. Thursday
B. Friday
C. Saturday
D. Sunday

Solution

  1. Step 1: Use Zeller (month > 2 so no year change)

    q = 15, m = 8, year = 1947.
  2. Step 2: Compute K and J

    K = 1947 % 100 = 47, J = floor(1947/100) = 19.
  3. Step 3: Evaluate components

    floor(13*(m+1)/5) = floor(13*9/5) = 23;
    floor(K/4)=floor(47/4)=11;
    floor(J/4)=4;
    5J=95.
    Sum: h = (15 + 23 + 47 + 11 + 4 + 95) = 195195 mod 7 = 6.
  4. Step 4: Map to weekday

    Zeller mapping: 6 → Friday. So 15 Aug 1947 = Friday.
  5. Final Answer:

    Friday → Option B
  6. Quick Check:

    Historical calendars confirm 15-Aug-1947 was Friday ✅
Hint: Cross-check Zeller with an odd-day count or known historical anchor if unsure.
Common Mistakes: Indexing errors with month codes or misreading Zeller's mapping.
3. What day of the week was 1st January 2010?
easy
A. Thursday
B. Saturday
C. Friday
D. Sunday

Solution

  1. Step 1: Adjust for January

    Use q = 1, m = 13, year = 2009 (Jan treated as month 13 of previous year).
  2. Step 2: Compute K and J

    K = 2009 % 100 = 9, J = floor(2009/100) = 20.
  3. Step 3: Evaluate components

    floor(13*(m+1)/5) = 36;
    floor(K/4)=floor(9/4)=2;
    floor(J/4)=floor(20/4)=5;
    5J=100.
    Sum: h = (1 + 36 + 9 + 2 + 5 + 100) = 153153 mod 7 = 6.
  4. Step 4: Map to weekday

    Zeller mapping: 6 → Friday. So 1 Jan 2010 = Friday.
  5. Final Answer:

    Friday → Option C
  6. Quick Check:

    New Year 2010 is known to be Friday ✅
Hint: Remember to decrement the year for Jan/Feb conversions before computing K and J.
Common Mistakes: Forgetting the Jan/Feb adjustment or misinterpreting h→weekday mapping.
4. What day of the week was 29th February 2000 (leap day)?
medium
A. Monday
B. Wednesday
C. Thursday
D. Tuesday

Solution

  1. Step 1: Treat February as month 14 of previous year

    For Zeller use q = 29, m = 14, year = 1999.
  2. Step 2: Compute K and J

    K = 1999 % 100 = 99, J = floor(1999/100) = 19.
  3. Step 3: Evaluate components

    floor(13*(m+1)/5) = floor(13*15/5) = 39;
    floor(K/4)=24;
    floor(J/4)=4;
    5J=95.
    Sum: h = (29 + 39 + 99 + 24 + 4 + 95) = 290290 mod 7 = 3.
  4. Step 4: Map to weekday

    Zeller mapping: 3 → Tuesday. So 29 Feb 2000 = Tuesday.
  5. Final Answer:

    Tuesday → Option D
  6. Quick Check:

    Historical references list 29-Feb-2000 as Tuesday ✅
Hint: For Feb in leap years use month = 14 and previous year; reduce modulo 7 early to simplify arithmetic.
Common Mistakes: Mismapping Zeller's h to weekday names or forgetting to shift year for Jan/Feb.
5. What day of the week was 31st December 1999?
medium
A. Friday
B. Thursday
C. Saturday
D. Sunday

Solution

  1. Step 1: Month > 2 (no adjustment)

    q = 31, m = 12, year = 1999.
  2. Step 2: Compute K and J

    K = 99, J = 19.
  3. Step 3: Evaluate formula pieces

    floor(13*(12+1)/5)=33;
    floor(K/4)=24;
    floor(J/4)=4;
    5J=95.
    Sum: h = (31 + 33 + 99 + 24 + 4 + 95) = 286286 mod 7 = 6.
  4. Step 4: Map to weekday

    Zeller mapping: 6 → Friday. So 31 Dec 1999 = Friday.
  5. Final Answer:

    Friday → Option A
  6. Quick Check:

    Day before 1 Jan 2000 (Saturday) is Friday ✅
Hint: After computing h, map Zeller's index carefully (0=Sat,…,6=Fri) and cross-check adjacent known dates.
Common Mistakes: Reading h directly as conventional weekday without applying the mapping.

Mock Test

Ready for a challenge?

Take a 10-minute AI-powered test with 10 questions (Easy-Medium-Hard mix) and get instant SWOT analysis of your performance!

10 Questions
5 Minutes