Modulo Operator Explained

The leap year rule in the Earthian Calendar uses a mathematical operator that may at first seem unfamiliar to some readers. However, in actual fact almost everyone has encountered this operator in primary school (US: "grade school") mathematics, and we use it in day-to-day life without even realising. "mod" is just a formal mathematical notation for a simple calculation that we do all the time.

The mod operator simply means "remainder after division". Remember when we were at school, and we first started learning to divide numbers and didn't know anything about fractions and decimal points, we used to talk about the "remainder". For example, we would say:

7 ÷ 3 = 2 remainder 1

because

7 = (2 × 3) + 1

Now, if we are only interested in the remainder part of the result, we can use the modulo operator like this:

7 mod 3 = 1

 

We already use the modulo operator in the leap year rules for the Gregorian Calendar. For example, when we say "it's a leap year if the year is divisible by 4", what we are really saying is "it's a leap year if year mod 4 = 0". It means that if we can divide the year by 4 with no remainder, then it will be a leap year.

So, we know that the year 2008 is a leap year, because

2008 ÷ 4 = 502 remainder 0

or in other words:

2008 mod 4 = 0

Similarly, we know that 2009 will not be a leap year, because if we divide it by 4, there will be a remainder of 1:

2009 mod 4 = 1

 

Usage of mod in the Earthian Calendar leap year rule

The modulo operator is used in the Earthian Calendar to create a 33-year cycle that includes 8 evenly-spaced leap years.

When we use the mod operator, the result is always limited to a number less than the divisor. For example, when we divide by 4, the remainder will always be 0, 1, 2 or 3. To illustrate:

2008 mod 4 = 0
2009 mod 4 = 1
2010 mod 4 = 2
2011 mod 4 = 3
2012 mod 4 = 0
2013 mod 4 = 1
2014 mod 4 = 2
2015 mod 4 = 3

Note how "mod 4" creates a repeating pattern of 4 years.

The Earthian Calendar leap year rule states that it's a leap year if:

year mod 33 mod 4 = 2

Consider the first part of the equation "year mod 33". This always returns a result from 0-32, which gives us our 33-year cycle. The second mod operator "mod 4" gives a result from 0-3, which creates a repeating 4-year cycle within the 33-year cycle. By specifying that a leap year occurs when the result of the equation equals 2, we get the required 8 leap years per 33 years in the symmetrical pattern 001000100010001000100010001000100.

The following table shows how the formula generates the required leap year pattern over the first 3 generations of the calendar:

year year mod 33 year mod 33 mod 4 a leap year?
0 0 0 no
1 1 1 no
2 2 2 YES
3 3 3 no
4 4 0 no
5 5 1 no
6 6 2 YES
7 7 3 no
8 8 0 no
9 9 1 no
10 10 2 YES
11 11 3 no
12 12 0 no
13 13 1 no
14 14 2 YES
15 15 3 no
16 16 0 no
17 17 1 no
18 18 2 YES
19 19 3 no
20 20 0 no
21 21 1 no
22 22 2 YES
23 23 3 no
24 24 0 no
25 25 1 no
26 26 2 YES
27 27 3 no
28 28 0 no
29 29 1 no
30 30 2 YES
31 31 3 no
32 32 0 no
33 0 0 no
34 1 1 no
35 2 2 YES
36 3 3 no
37 4 0 no
38 5 1 no
39 6 2 YES
40 7 3 no
41 8 0 no
42 9 1 no
43 10 2 YES
44 11 3 no
45 12 0 no
46 13 1 no
47 14 2 YES
48 15 3 no
49 16 0 no
50 17 1 no
51 18 2 YES
52 19 3 no
53 20 0 no
54 21 1 no
55 22 2 YES
56 23 3 no
57 24 0 no
58 25 1 no
59 26 2 YES
60 27 3 no
61 28 0 no
62 29 1 no
63 30 2 YES
64 31 3 no
65 32 0 no
66 0 0 no
67 1 1 no
68 2 2 YES
69 3 3 no
70 4 0 no
71 5 1 no
72 6 2 YES
73 7 3 no
74 8 0 no
75 9 1 no
76 10 2 YES
77 11 3 no
78 12 0 no
79 13 1 no
80 14 2 YES
81 15 3 no
82 16 0 no
83 17 1 no
84 18 2 YES
85 19 3 no
86 20 0 no
87 21 1 no
88 22 2 YES
89 23 3 no
90 24 0 no
91 25 1 no
92 26 2 YES
93 27 3 no
94 28 0 no
95 29 1 no
96 30 2 YES
97 31 3 no
98 32 0 no