Astronomy Answers: Julian Day Number

Astronomy Answers
Julian Day Number


[Astronomy Answers] [Dictionary] [AnswerBook] [Universe Family Tree] [Science] [Starry Sky] [Planet Positions] [Calculate] [Colophon]

1. Derivation of the General Algorithms ... 1.1. Notation ... 1.2. Large Intermediate Results ... 1.3. The Simple Calendar ... 1.3.1. From Month and Day Number Within the Month to Running Day Number ... 1.3.2. Month Length ... 1.3.3. Shifting the Pattern of Months ... 1.3.4. From Running Day Number to Month and Day Number Within the Month ... 1.4. With Whole Numbers Only ... 1.5. Very Unequal Months

\(\def\|{&}\DeclareMathOperator{\D}{\bigtriangleup\!} \DeclareMathOperator{\d}{\text{d}\!}\)

\( \DeclareMathOperator{\trunc}{trunc} \DeclareMathOperator{\Div}{div} \DeclareMathOperator{\gcd}{gcd} \DeclareMathOperator{\bdom}{dom} \def\dfloor#1{\left\lfloor #1 \right\rfloor} \def\dceil#1{\left\lceil #1 \right\rceil} \def\dparen#1{\left( #1 \right)} \def\dmod#1#2{\left\lfloor #1 \right\rceil_{#2}} \def\ddom#1#2{\left\lceil #1 \right\rfloor_{#2}} \def\dabs#1{\left| #1 \right|} \def\floorratio#1#2{\dfloor{\dfrac{#1}{#2}}} \def\ceilratio#1#2{\dceil{\dfrac{#1}{#2}}} \def\mod1ratio#1#2{\left\lfloor \dfrac{#1}{#2} \right\rceil_1} \def\dom1ratio#1#2{\left\lceil \dfrac{#1}{#2} \right\rfloor_1} \def\eqvide#1{\qquad\text{(vide \eqref{#1})}} \def\eqavide#1{\|\text{(vide \eqref{#1})}} \)

1. Derivation of the General Algorithms

We can derive many calendar formulas by finding straight lines that, with rounding, yield the correct results.

1.1. Notation

We use special notation for some things that are useful later.

A few useful relationships (for \( p \gt 0 \)):

  1. \begin{equation} \dceil{\dceil{x}} = \dfloor{\dceil{x}} = \dceil{x}\end{equation}
  2. \begin{equation} \dfloor{\dfloor{x}} = \dceil{\dfloor{x}} = \dfloor{x} \end{equation}
  3. \begin{equation} \dmod{\dmod{x}{p}}{p} = \ddom{\dmod{x}{p}}{p} = \dmod{x}{p} \label{eq:modmod} \end{equation}
  4. \begin{equation} \ddom{\ddom{x}{p}}{p} = \dmod{\ddom{x}{p}}{p} = \ddom{x}{p} \label{eq:domdom} \end{equation}
  5. \begin{equation} \dmod{x ± y}{p} = \dmod{\dmod{x}{p} ± \dmod{y}{p}}{p} \label{eq:dmod2} \end{equation}
  6. \begin{equation} \ddom{x ± y}{p} = \ddom{\ddom{x}{p} ± \ddom{y}{p}}{p} \label{eq:ddom2} \end{equation}
  7. \begin{equation} \dceil{x} − \dfloor{x} = C(x⊥1) \label{eq:ceilfloor} \end{equation}
  8. \begin{equation} \dmod{x}{p} + \ddom{x}{p} = pC(x⊥p) \end{equation}
  9. \begin{equation} \dfloor{−x} = −\dceil{x} = −\dfloor{x} − C(x⊥1) \label{eq:minusfloor} \end{equation}
  10. \begin{equation} \dceil{−x} = −\dfloor{x} = −\dceil{x} + C(x⊥1) \label{eq:minusceil} \end{equation}
  11. \begin{equation} \dmod{−x}{p} = \ddom{x}{p} = −\dmod{x}{p} + pC(x⊥p) \end{equation}
  12. \begin{equation} \ddom{−x}{p} = \dmod{x}{p} = −\ddom{x}{p} + pC(x⊥p) \end{equation}
  13. \begin{equation} \dfloor{x + y} = \dfloor{x} + \dfloor{y} + C\dparen{\dmod{x}{1} + \dmod{y}{1} ≥ 1} \label{eq:splitfloor} \end{equation}
  14. \begin{equation} \dfloor{x − y} = \dfloor{x} − \dfloor{y} − C\dparen{\dmod{x}{1} − \dmod{y}{1} \lt 0} \label{eq:floorm} \end{equation}
  15. \begin{equation} \dmod{x + y}{p} = \dmod{x}{p} + \dmod{y}{p} − pC\dparen{\dmod{x}{p} + \dmod{y}{p} ≥ p} \label{eq:modp} \end{equation}
  16. \begin{equation} \dmod{x − y}{p} = \dmod{x}{p} − \dmod{y}{p} + pC\dparen{\dmod{x}{p} − \dmod{y}{p} \lt 0} \end{equation}
  17. \begin{equation} \dceil{x + y} = \dceil{x} + \dceil{y} − C\dparen{\dmod{x}{1} + \dmod{y}{1} ≥ 1} \end{equation}
  18. \begin{equation} \dceil{x − y} = \dceil{x} − \dceil{y} + C\dparen{\dmod{x}{1} − \dmod{y}{1} \lt 0} \end{equation}
  19. \begin{equation} \ddom{x + y}{p} = \ddom{x}{p} + \ddom{y}{p} − pC\dparen{\ddom{x}{p} + \ddom{y}{p} ≥ p} \label{eq:domp} \end{equation}
  20. \begin{equation} \ddom{x − y}{p} = \ddom{x}{p} − \ddom{y}{p} + pC\dparen{\ddom{x}{p} − \ddom{y}{p} \lt 0} \label{eq:domm} \end{equation}

And their proofs:

  1. \( \dceil{\dceil{x}} = \dfloor{\dceil{x}} = \dceil{x}\) because \( \dceil{x} \) is a whole number.
  2. \( \dfloor{\dfloor{x}} = \dceil{\dfloor{x}} = \dfloor{x} \) because \( \dfloor{x} \) is a whole number.
  3. \( \dmod{\dmod{x}{p}}{p} = \ddom{\dmod{x}{p}}{p} = \dmod{x}{p} \) because \( 0 \le \dmod{x}{p} \lt p \).
  4. \( \ddom{\ddom{x}{p}}{p} = \dmod{\ddom{x}{p}}{p} = \ddom{x}{p} \) because \( 0 \le \ddom{x}{p} \lt p \).
  5. \( \dmod{x ± y}{p} = \dmod{\dmod{x}{p} ± \dmod{y}{p}}{p} \) because

    \begin{align} \dmod{x ± y}{p} \| = p\dmod{\dfrac{x ± y}{p}}{1} \notag \eqavide{eq:mod1top} \\ \| = p\dmod{\dfrac{p\floorratio{x}{p} + \dmod{x}{p} ± \dparen{p\floorratio{y}{p} + \dmod{y}{p}}}{p}}{1} \eqavide{eq:mod} \notag \\ \| = p\dmod{\floorratio{x}{p} ± \floorratio{y}{p} + \dfrac{\dmod{x}{p} ± \dmod{y}{p}}{p}}{1} \notag \\ \| = p\dmod{\dfrac{\dmod{x}{p} ± \dmod{y}{p}}{p}}{1} \eqavide{eq:modn} \notag \\ \| = \dmod{\dmod{x}{p} ± \dmod{y}{p}}{p} \eqavide{eq:mod1top} \end{align}

  6. \( \ddom{x ± y}{p} = \ddom{\ddom{x}{p} ± \ddom{y}{p}}{p} \) because

    \begin{align} \ddom{x ± y}{p} \| = p\ddom{\dfrac{x ± y}{p}}{1} \notag \eqavide{eq:dom1top} \\ \| = p\ddom{\dfrac{p\ceilratio{x}{p} − \ddom{x}{p} ± \dparen{p\ceilratio{y}{p} − \ddom{y}{p}}}{p}}{1} \eqavide{eq:dom} \notag \\ \| = p\ddom{\ceilratio{x}{p} ± \ceilratio{y}{p} − \dparen{\dfrac{\ddom{x}{p} ± \ddom{y}{p}}{p}}}{1} \notag \\ \| = p\ddom{−\dfrac{\ddom{x}{p} ± \ddom{y}{p}}{p}}{1} \eqavide{eq:domn} \label{eq:xpyp} \end{align}

    so also

    \begin{align} \ddom{\ddom{x}{p} ± \ddom{y}{p}}{p} \| = p\ddom{−\dfrac{\ddom{\ddom{x}{p}}{p} ± \ddom{\ddom{y}{p}}{p}}{p}}{1} \eqavide{eq:xpyp} \notag \\ \| = p\ddom{−\dfrac{\ddom{x}{p} ± \ddom{y}{p}}{p}}{1} \eqavide{eq:domdom} \notag \\ \| = \ddom{x ± y}{p} \eqavide{eq:xpyp} \end{align}

  7. \( \dceil{x} − \dfloor{x} = C(x⊥1) \) because when \( x \) is a whole number (so \( x∥1 \)) then \( \dceil{x} \) and \( \dfloor{x} \) are equal to \( x \), and otherwise the next higher whole nuber (\( \dceil{x} \)) is one greater than the next lower whole number (\( \dfloor{x} \)).

  8. \( \dmod{x}{p} + \ddom{x}{p} = pC(x⊥p) \) because

    \begin{align} \dmod{x}{p} + \ddom{x}{p} \| = x − p\floorratio{x}{p} + p\ceilratio{x}{p} − x \| \text{(vide \eqref{eq:mod}, \eqref{eq:dom})} \notag \\ \| = p \dparen{\ceilratio{x}{p} − \floorratio{x}{p}} \notag \\ \| = p C\dparen{\dfrac{x}{p} ⊥ 1} \notag \eqavide{eq:ceilfloor} \\ \| = p C\dparen{x ⊥ p} \end{align}

  9. For \( \dfloor{−x} = −\dceil{x} = −\dfloor{x} − C(x⊥1) \) the second \( = \) follows from Equation \eqref{eq:ceilfloor}.

    We prove the first \( = \) as follows.

    \begin{align} \dfloor{−x} \| = \dfloor{−\dfloor{x} − \dmod{x}{1}} \eqavide{eq:mod} \notag \\ \| = −\dfloor{x} + \dfloor{−\dmod{x}{1}} \\ \dceil{x} \| = \dceil{\dfloor{x} + \ddom{x}{1}} \eqavide{eq:dom} \notag \\ \| = \dfloor{x} + \dceil{\ddom{x}{1}} \\ \dfloor{−x} + \dceil{x} \| = \dfloor{−\dmod{x}{1}} + \dceil{\ddom{x}{1}} \end{align}

    If \( x \) is a whole number then \( \dmod{x}{1} = \ddom{x}{1} = 0 \) so \( \dfloor{−x} + \dceil{x} = 0 \).

    And if \( x \) is not a whole number then

    \begin{equation} 0 \lt \dmod{x}{1} \lt 1 ⇒ \dceil{\dmod{x}{1}} = 1 \end{equation}

    and also

    \begin{equation} −1 \lt −\dmod{x}{1} \lt 0 ⇒ \dfloor{−\dmod{x}{1}} = −1 \end{equation}

    so then, too, \( \dfloor{−x} + \dceil{x} = \dceil{\dmod{x}{1}} + \dfloor{−\dmod{x}{1}} = 0 \) and so \( \dfloor{−x} = −\dceil{x} \).

  10. For \( \dceil{−x} = −\dfloor{x} = −\dceil{x} + C(x⊥1) \), the second \( = \) follows from Equation \eqref{eq:ceilfloor}.

    The first \( = \) follows from Equation \eqref{eq:minusfloor} if you replace every \( x \) by \( −x \).

  11. For \( \dmod{−x}{p} = \ddom{x}{p} = −\dmod{x}{p} + pC(x⊥p) \) the first \( = \) follows from

    \begin{align} \dmod{−x}{p} \| = −x − p\floorratio{−x}{p} \eqavide{eq:mod} \notag \\ \| = p\ceilratio{x}{p} − x \eqavide{eq:minusfloor} \notag \\ \| = \ddom{x}{p} \eqavide{eq:dom} \end{align}

    and the second \( = \) from

    \begin{align} \dmod{x}{p} \| = x − p\floorratio{x}{p} \notag \eqavide{eq:mod} \\ \| = x − p\dparen{\ceilratio{x}{p} − C\dparen{\dfrac{x}{p} ⊥ 1}} \notag \eqavide{eq:ceilfloor} \\ \| = x − p\ceilratio{x}{p} + pC\dparen{x ⊥ p} \notag \\ \| = −\ddom{x}{p} + pC\dparen{x ⊥ p} \eqavide{eq:dom} \end{align}

  12. \( \ddom{−x}{p} = \dmod{x}{p} = −\ddom{x}{p} + pC(x⊥p) \) follows from the previous one if you replace every \( x \) with \( −x \).

  13. \( \dfloor{x + y} = \dfloor{x} + \dfloor{y} + C\dparen{\dmod{x}{1} + \dmod{y}{1} ≥ 1} \) because

    \begin{align} \dfloor{x ± y} \| = x ± y − \dmod{x ± y}{1} \eqavide{eq:mod} \notag \\ \| = \dfloor{x} + \dmod{x}{1} ± \dparen{\dfloor{y} + \dmod{y}{1}} − \dmod{x ± y}{1} \eqavide{eq:mod} \notag \\ \| = \dfloor{x} ± \dfloor{y} + \dmod{x}{1} ± \dmod{y}{1} − \dmod{x ± y}{1} \notag \\ \| = \dfloor{x} ± \dfloor{y} + \dmod{x}{1} ± \dmod{y}{1} − \dmod{\dmod{x}{1} ± \dmod{y}{1}}{1} \eqavide{eq:dmod2} \label{eq:floorpm} \end{align}

    We have

    \begin{align} \dmod{\dmod{x}{1} + \dmod{y}{1}}{1} \| = \dmod{x}{1} + \dmod{y}{1} − C\dparen{\dmod{x}{1} + \dmod{y}{1} \ge 1} \\ \dmod{\dmod{x}{1} − \dmod{y}{1}}{1} \| = \dmod{x}{1} − \dmod{y}{1} + C\dparen{\dmod{x}{1} − \dmod{y}{1} \lt 0} \label{eq:mod1m} \end{align}

    because \( 0 \le \dmod{•}{1} \lt 1 \). So

    \begin{equation} \dfloor{x + y} = \dfloor{x} + \dfloor{y} + C\dparen{\dmod{x}{1} + \dmod{y}{1} \ge 1} \end{equation}

  14. \( \dfloor{x − y} = \dfloor{x} − \dfloor{y} + C\dparen{\dmod{x}{1} − \dmod{y}{1} \lt 0} \) follows from Eqs. \eqref{eq:floorpm} and \eqref{eq:mod1m}.
  15. \( \dmod{x + y}{p} = \dmod{x}{p} + \dmod{y}{p} − pC\dparen{\dmod{x}{p} + \dmod{y}{p} ≥ p} \) follows from

    \begin{align} \dmod{x ± y}{p} \| = x ± y − p\floorratio{x ± y}{p} \eqavide{eq:mod} \notag \\ \| = p\floorratio{x}{p} + \dmod{x}{p} ± \dparen{p\floorratio{y}{p} + \dmod{y}{p}} \notag \\ \| − p\floorratio{p\floorratio{x}{p} + \dmod{x}{p} ± \dparen{p\floorratio{y}{p} + \dmod{y}{p}}}{p} \notag \eqavide{eq:mod} \\ \| = p\floorratio{x}{p} + \dmod{x}{p} ± p\floorratio{y}{p} ± \dmod{y}{p} \notag \\ \| − p\floorratio{x}{p} ∓ p\floorratio{y}{p} − p\floorratio{\dmod{x}{p} ± \dmod{y}{p}}{p} \notag \\ \| = \dmod{x}{p} ± \dmod{y}{p} − p\floorratio{\dmod{x}{p} ± \dmod{y}{p}}{p} \label{eq:i15a} \end{align}

    We have

    \begin{align} \floorratio{\dmod{x}{p} + \dmod{y}{p}}{p} \| = C\dparen{\dmod{x}{p} + \dmod{y}{p} \ge p} \label{eq:i15c} \\ \floorratio{\dmod{x}{p} − \dmod{y}{p}}{p} \| = −C\dparen{\dmod{x}{p} − \dmod{y}{p} \lt 0} \label{eq:i15b} \end{align}

    because \( 0 \le \dmod{•}{p} \lt p \), so

    \begin{equation} \dmod{x}{p} + \dmod{y}{p} − p\floorratio{\dmod{x}{p} + \dmod{y}{p}}{p} = \dmod{x}{p} + \dmod{y}{p} − pC\dparen{\dmod{x}{p} + \dmod{y}{p} \ge p} \end{equation}

    which completes the proof.

  16. \( \dmod{x − y}{p} = \dmod{x}{p} − \dmod{y}{p} + pC\dparen{\dmod{x}{p} − \dmod{y}{p} \lt 0} \) follows from Eqs. \eqref{eq:i15a} and \eqref{eq:i15b}.
  17. \( \dceil{x + y} = \dceil{x} + \dceil{y} − C\dparen{\dmod{x}{1} + \dmod{y}{1} ≥ 1} \) because

    \begin{align} \dceil{x ± y} \| = x ± y + \ddom{x ± y}{p} \notag \eqavide{eq:dom} \\ \| = \dceil{x} − \ddom{x}{1} ± \dparen{\dceil{y} − \ddom{y}{1}} + \ddom{x ± y}{p} \notag \eqavide{eq:dom} \\ \| = \dceil{x} ± \dceil{y} − \ddom{x}{1} ∓ \ddom{y}{1} + \ddom{x ± y}{p} \label{eq:i17} \end{align}

    That leads to

    \begin{align} \dceil{x + y} \| = \dceil{x} + \dceil{y} − \ddom{x}{1} − \ddom{y}{1} + \ddom{x + y}{p} \notag \\ \| = \dceil{x} + \dceil{y} − \ddom{x}{1} − \ddom{y}{1} + \ddom{x}{1} + \ddom{y}{1} − C\dparen{\ddom{x}{1} + \ddom{y}{1} ≥ 1} \eqavide{eq:domp} \notag \\ \| = \dceil{x} + \dceil{y} − C\dparen{\ddom{x}{1} + \ddom{y}{1} ≥ 1} \end{align}

  18. \( \dceil{x − y} = \dceil{x} − \dceil{y} + C\dparen{\dmod{x}{1} − \dmod{y}{1} \lt 0} \) because

    \begin{align} \dceil{x − y} \| = \dceil{x} − \dceil{y} − \ddom{x}{1} + \ddom{y}{1} + \ddom{x − y}{p} \notag \eqavide{eq:i17} \\ \| = \dceil{x} − \dceil{y} − \ddom{x}{1} + \ddom{y}{1} + \ddom{x}{1} − \ddom{y}{1} + C\dparen{\ddom{x}{1} − \ddom{y}{1} \lt 0} \eqavide{eq:modp} \notag \\ \| = \dceil{x} − \dceil{y} + C\dparen{\ddom{x}{1} − \ddom{y}{1} \lt 0} \end{align}

  19. \( \ddom{x + y}{p} = \ddom{x}{p} + \ddom{y}{p} − pC\dparen{\ddom{x}{p} + \ddom{y}{p} ≥ p} \) because

    \begin{align} \ddom{x ± y}{p} = \| p\ceilratio{x ± y}{p} − \dparen{x ± y} \notag \eqavide{eq:dom} \\ = \| p\ceilratio{p\ceilratio{x}{p} − \ddom{x}{p} ± \dparen{p\ceilratio{y}{p} − \ddom{y}{p}}}{p} \notag \\ \| − \dparen{p\ceilratio{x}{p} − \ddom{x}{p} ± \dparen{p\ceilratio{y}{p} − \ddom{y}{p}}} \notag \eqavide{eq:dom} \\ = \| p\ceilratio{x}{p} ± p\ceilratio{y}{p} + p\ceilratio{−\ddom{x}{p} ∓ \ddom{y}{p}}{p} \notag \\ \| − \dparen{p\ceilratio{x}{p} ± p\ceilratio{y}{p} − \dparen{\ddom{x}{p} ± \ddom{y}{p}}} \notag \\ = \| \ddom{x}{p} ± \ddom{y}{p} + p\ceilratio{−\ddom{x}{p} ∓ \ddom{y}{p}}{p} \label{eq:i19a} \end{align}

    We have

    \begin{align} \ceilratio{−\ddom{x}{p} − \ddom{y}{p}}{p} \| = −C\dparen{\ddom{x}{p} + \ddom{y}{p} \ge p} \\ \ceilratio{−\ddom{x}{p} + \ddom{y}{p}}{p} \| = C\dparen{\ddom{x}{p} − \ddom{y}{p} \lt 0} \label{eq:i19b} \end{align}

    because \( 0 \le \ddom{•}{p} \lt 1 \), so

    \begin{equation} \ddom{x}{p} + \ddom{y}{p} + p\ceilratio{\ddom{x}{p} + \ddom{y}{p}}{p} = \ddom{x}{p} + \ddom{y}{p} − pC\dparen{\ddom{x}{p} + \ddom{y}{p} \ge p} \end{equation}

    which completes the proof.

  20. \( \ddom{x − y}{p} = \ddom{x}{p} − \ddom{y}{p} + pC\dparen{\ddom{x}{p} − \ddom{y}{p} \lt 0} \) follows from Eqs. \eqref{eq:i19a} and \eqref{eq:i19b}.

1.2. Large Intermediate Results

Many of the calendar calculations that are described below are of the type

\begin{align} y \| = \floorratio{fx + t}{d} \label{eq:template} \\ e \| = \dmod{fx + t}{d} = (fx + t) \bmod d \label{eq:template-e} \end{align}

i.e.,

\[ \{y, e\} = \Div(fx + t, d) \]

with

\begin{equation} fx + t = dy + e \end{equation}

where \( f \), \( t \), \( d \) are fixed whole numbers with \( f, d \gt 1 \) and \( 0 ≤ e \lt d \) and \( y \), \( x \) are variable but whole numbers. The intermediate result \( fx + t \) is then usually much greater in magnitude than \( x \) and than the end result. This can give trouble on calculators and in computer programs where whole numbers cannot exceed a certain size that we'll refer to as \( w \). (Floating-point numbers like 1.234 × 1020 can be much greater, but have limited accuracy, and then you have to worry about round-off errors.)

Intermediate results greater than \( w \) give trouble, so to avoid trouble we'd need roughly \( |fx| ≤ w \), so \( |x| ≤ w/f \), which is much less than \( w \) itself.

If \( |t| ≥ d \), then we can rewrite equation \eqref{eq:template}ff to

\begin{align} fx + t \| = fx + \floorratio{t}{d} d + \dmod{t}{d} = dy + e \eqavide{eq:mod} \\ y \| = \floorratio{fx + t}{d} = \floorratio{t}{d} + \floorratio{fx + \dmod{t}{d}}{d} \\ e \| = \dmod{fx + t}{d} = \dmod{fx + \dmod{t}{d}}{d} \eqavide{eq:modmod} \end{align}

where the second term of the last two equations has the same form as equation \eqref{eq:template}, if you rename \( \dmod{t}{d} \) to a new \( t \). Below, we assume that that has been done, which means that \( |t| \lt d \).

If \( f \gt d \), then we can rewrite equation \eqref{eq:template}ff to

\begin{align} fx + t \| = \dparen{\floorratio{f}{d} d + \dmod{f}{d}} x + t = dy + e \eqavide{eq:mod} \\ y \| = \floorratio{f}{d} x + \floorratio{\dmod{f}{d} x + t}{d} \label{eq:template2} \\ e \| = \dmod{\dmod{f}{d} x + t}{d} \end{align}

Then \( |x| \) may be nearly as great as \( w/\dmod{f}{d} \) before we run into trouble.

Equations \eqref{eq:template2}ff again have the form of equations \eqref{eq:template}ff, if you rename \( \dmod{f}{d} \) to a new \( f \). Below, we assume that this has been done, so that \( f \lt d \).

If we could first do the division by \( d \) and then the multiplication by \( f \), then the intermediate results would stay smaller than \( x \) itself. We'd like to calculate something like \( f\floorratio{x}{d} \) which is roughly equal to \( y \), and then apply a correction to get the real \( y \).

We can rewrite equation \eqref{eq:template}ff to

\begin{align} fx + t \| = f\dparen{ \floorratio{x}{d} d + \dmod{x}{d}} + t \eqavide{eq:mod} \\ y \| = f\floorratio{x}{d} + \floorratio{f\dmod{x}{d} + t}{d} \label{eq:detour1} \\ e \| = \dmod{f\dmod{x}{d} + t}{d} \end{align}

Now the greatest intermediate result is no longer \( fx + t \), which can get as large as \( fw \), but \( f\dmod{x}{d} + t \), which cannot exceed \( fd \lt d^2 \).

Equations \eqref{eq:detour1}ff again have the form of equations \eqref{eq:template}ff, if you rename \( \dmod{x}{d} \) to a new \( x \).

For example, let \( d = 12345 \), \( f = 8432 \), \( t = 871 \), and \( w = 2^{31} − 1 = 2\ 147\ 483\ 647 \), and suppose we want to calculate \( y \), \( e \) for \( x = 300\ 000 \).

We use the detour of equation \eqref{eq:detour1}. We find

\begin{align*} \floorratio{x}{d} \| = \floorratio{300\ 000}{12345} = 24 \\ \dmod{x}{d} \| = \dmod{300\ 000}{12345} = 3720 \\ y = \| f\floorratio{x}{d} + \floorratio{f\dmod{x}{d} + t}{d} \\ \| = 8432×24 + \floorratio{8432×3720 + 871}{12345} \\ \| = 202\ 368 + \floorratio{31\ 367\ 911}{12345} \\ \| = 202\ 368 + 2540 = 204\ 908 \\ e \| = \dmod{31\ 367\ 911}{12345} = 11611 \end{align*}

The greatest intermediate result is 31 367 911, which is much less than \( w \).

If we could have used arbitrarily large intermediate results, then we'd have found

\begin{align*} y \| = \floorratio{fx + t}{d} = \floorratio{8432×300\ 000 + 871}{12345} = \floorratio{252\ 960\ 0871}{12345} = 204\ 908 \\ e \| = \dmod{2\ 529\ 600\ 871}{12345} = 11611 \end{align*}

which are the same results, but with a greatest intermediate result of 2 529 600 871 which is greater than \( w \).

Sometimes an intermediate result of (nearly) \( \dmod{f}{d}d \) is still too great, because the product of two numbers can be much greater than \( w \) even if the two numbers are each much less than \( w \). If the product must remain less than \( w \), then the two numbers cannot both be greater than \( \sqrt{w} \), which is a lot less than \( w \) itself. For example, for 32-bit numbers, \( w = 2^{31} − 1 = 2\ 147\ 483\ 647 \) and \( \sqrt{w} = 46341 \), so even if \( d \) and \( \dmod{f}{d} \) are both just a bit greater than 46431, which isn't really very large, then \( \dmod{f}{d}d \) is already too great to fit into a 32-bit number.

Suppose we pick a \( P \gt 0 \) and then calculate one time

\begin{align} \{Q, R\} \| = \Div(fP, d) \\ Q \| = \floorratio{fP}{d} \\ R \| = \dmod{fP}{d} \end{align}

so

\begin{equation} fP = dQ + R \end{equation}

Then, for each desired \( x \), calculate

\begin{align} \{q, r\} \| = \Div(x, P) \\ q \| = \floorratio{x}{P} \\ r \| = \dmod{x}{P} \end{align}

so

\begin{equation} x = qP + r \end{equation}

and then

\begin{align} fx + t \| = fqP + fr + t = qdQ + qR + fr + t \\ y \| = \floorratio{qdQ + qR + fr + t}{d} = qQ + \floorratio{qR + fr + t}{d} \label{eq:detour2} \\ e \| = \dmod{qdQ + qR + fr + t}{d} = \dmod{qR + fr + t}{d} \end{align}

Now the greatest intermediate result is \( m ≡ qR + fr + t \). We know that \( r \lt P \), so \( fr \lt fP \). To stay out of trouble we need \( |m| ≤ w \). We have

\[ |m| ≤ \dabs{\floorratio{x}{P}} R + fP + |t| ≤ |x|\frac{R}{P} + fP + |t| \]

so we need

\[ |x|\frac{R}{P} + fP + |t| ≤ w \]

If \( R = 0 \), then we need \( fP + |t| ≤ w \), so then

\begin{equation} P ≤ \frac{w − |t|}{f} \end{equation}

If \( R \gt 0 \) then we need

\begin{equation} |x| ≤ X ≡ (w − fP − |t|) \frac{P}{R} \end{equation}

We must have \( 0 \lt P \lt \dfrac{w − |t|}{f} ≤ \dfrac{w}{f} \), otherwise certainly \( X ≤ 0 \).

We want to make the range of \( x \) as large as possible, so we seek \( P \) and \( R \) such that \( X \) becomes as great as possible, given \( w \), \( f \), \( t \). This means that \( R \) should preferably be small.

If we use equations \eqref{eq:detour1}ff then it is sufficient if \( X ≥ d \) to be able to handle all values \( |x| \lt w \), because then we can use equations \eqref{eq:detour1}ff to first make \( |x| \lt d \). If we do not use equations \eqref{eq:detour1}ff, then we must have \( X ≥ w \) to be able to handle all values \( |x| \lt w \).

There can be multiple combinations of \( P\), \( Q \), \( R \) that yield \( X ≥ w \) or \( X ≥ d \), and those are all good enough. Within that group, we prefer small \( P\), \( Q\), \( R \), because that makes for easier calculations.

The smallest possible positive value of \( R \) is equal to the greatest common divisor \( c \) of \( d \) and \( f \), and the corresponding \( P, Q \gt 0 \) can be found using the Extended Algorithm of Euclid ― or by trying all \( d \) or \( w/f \) (pick the smallest) possibilities for \( P \).

The Extended Algorithm of Euclid produces a relation of the form

\begin{equation} φf − δd = c \end{equation}

for \( c \gt 0 \) (if you find \( c \lt 0 \), then multiply \( φ \), \( δ \), and \( c \) by −1). If \( φ \) and \( δ \) are positive, then \( P_1 = φ \) and \( Q_1 = δ \), but \( φ \) and \( δ \) can be negative. In general, calculate \( P_1 \), \( Q_1 \), \( R_1 \) as follows:

\begin{align*} P_1 \| = \dmod{φ}{d/c} \\ Q_1 \| = \dmod{δ}{f/c} \\ R_1 \| = c \end{align*}

If that \( P = P_1 \), \( Q = Q_1 \), \( R = R_1 \) fit together, then

\begin{equation} fP_1 − dQ_1 = R_1 \end{equation}

Then also \( P = kP_1 \), \( Q = kQ_1 \), \( R = kR_1 \) belong together, for whole \( 0 \lt k ≤ \floorratio{d}{R_1} \), because \( R \) must be less than \( d \). To be able to handle greater values of \( k \), it is therefore better to calculate \( Q \) and \( R \) from \( P \) according to their definition.

\begin{align*} P \| = kP_1 \\ Q \| = \floorratio{fP}{d} = \floorratio{kfP_1}{d} = \floorratio{k(dQ_1 + R_1)}{d} = kQ_1 + \floorratio{kR_1}{d} \\ R \| = \dmod{fP}{d} = \dmod{k(dQ_1 + R_1)}{d} = \dmod{kR_1}{d} \end{align*}

so the curtailing of \( R \) to values less than \( d \) leads to an increase in \( Q \) so that \( fP − dQ = R \) is still satisfied. If \( kR_1 \lt d \), then \( P = kP_1 \), \( Q = kQ_1 \), and \( R = kR_1 \) as expected.

It is not useful to allow \( P ≥ d \), because otherwise the greatest intermediate result can be as great or greater than \( fP = fd \) which can become greater than \( w \), because if it couldn't exceed \( w \) then we could have used equation \eqref{eq:detour1} and would not need the current more complicated method at all. We seek \( P \lt d \).

If \( P_2 = P + md/c \), with \( c \) the greatest common divisor of \( f \) and \( d \), then

\begin{align*} Q_2 \| = \floorratio{fP_2}{d} = \floorratio{fP + m\dfrac{fd}{c}}{d} = \floorratio{fP}{d} + m\frac{f}{c} = Q + m\dfrac{f}{c} \\ R_2 \| = fP_2 − dQ_2 = fP + m\dfrac{fd}{c} − \dparen{dQ + m \dfrac{df}{c}} = fP − dQ = R \end{align*}

so if we add or subtract a multiple of \( d/c \) from \( P \), then \( Q \) shifts by the corresponding multiple of \( f/c \), and \( R \) remains the same. In particular, we can take

\begin{align} P \| = \dmod{kP_1}{d} \\ Q \| = \dmod{kQ_1}{f} \\ R \| = \dmod{kR_1}{d} \end{align}

for \( k \lt d \) because there are not more than that number of unique values of \( P \lt d \).

For example, let \( d = 765\ 433 \), \( f = 25920 \), \( t = 13835 \), \( w = 2^{31} − 1 = 2\ 147\ 483\ 647 \). Then \( \dfrac{w}{f} = \dfrac{2^{31} − 1 }{25920} ≈ 82850 \), so we seek a \( P \lt 82850 \lt 765\ 433 \), and an \( R \) as small as possible.

The Extended Algorithm of Euclid (or a search) for this \( d \) and \( f \) yields that \( 99902f − 3383d = 1 \), so \( P_1 = 99902 \), \( Q_1 = 3383 \), \( R_1 = 1 \). Then

\begin{align*} P \| = \dmod{kP_1}{d} \\ Q \| = \dmod{kQ_1}{f} \\ R \| = \dmod{kR_1}{d} \end{align*}

The following table shows a couple of combinations for small \( R \).

\({R}\) \({P}\) \({Q}\) \({Q′}\)
1 99 902 3383 3383
2 199 804 6766 6766
7 699 314 23681 23681
8 33 783 1144 1144
9 133 685 4527 4527

The next table shows the combinations with the greatest \( X \).

\({R}\) \({P}\) \({Q}\) \({X}\)
8 33 783 1144 5.4 × 1012
16 67 566 2288 1.7 × 1012
31 35 230 1193 1.4 × 1012
54 36 677 1242 8.1 × 1011
39 69 013 2337 6.3 × 1011

All of these \( X \) are comfortably greater than \( w ≈ 2.15×10^{9} \). \( X ≥ w \) for 1498 values of \( R \) between 8 and 20312, and \( X ≥ d \) for 82576 values of \( R \) between 8 and 765 426. We found solutions for \( X ≥ w \) so we do not need equations \eqref{eq:detour1}ff. Within the group with \( X ≥ w \) we search for the smallest values of \( PQR \). We find

\({R}\) \({P}\) \({Q}\) \({PQR}\) \({X}\)
23 1447 49 1.6 × 106 1.33 × 1011
46 2894 98 1.3 × 107 1.30 × 1011
544 945 32 1.6 × 107 3.69 × 109
69 4341 147 4.4 × 107 1.28 × 1011
92 5788 196 1.0 × 108 1.26 × 1011

We choose \( P = 1447 \), then \( R = 23 \) and \( Q = 49 \).

Now we calculate \( y \), \( e \) for \( x = 1\ 710\ 321 \). We find

\begin{align*} q \| = \floorratio{x}{P} = \floorratio{1\ 710\ 321}{1447} = 1181 \\ r \| = ⌊x⌉_P = \dmod{1\ 710\ 321}{1447} = 1414 \\ y \| = qQ + \floorratio{qR + fr + t}{d} \\ \| = 1181×49 + \floorratio{1181×23 + 25920×1414 + 13835}{765\ 433} \\ \| = 57869 + \floorratio{36\ 691\ 878}{765\ 433} \\ \| = 57869 + 47 = 57916 \\ e \| = \dmod{36\ 691\ 878}{765\ 433} = 716\ 527 \end{align*}

The greatest intermediate result is 36 691 878, which is considerably less than \( w \).

Had we been allowed arbitrarily large intermediate results, then we'd have found

\begin{align*} y \| = \floorratio{fx + t}{d} = \floorratio{25920×1\ 710\ 321 + 13835}{765\ 433} = \floorratio{44\ 331\ 534\ 155}{765\ 433} = 57916 \\ e \| = \dmod{44\ 331\ 534\ 155}{765\ 433} = 716\ 527 \end{align*}

which are the same results, but with the much greater intermediate result of 44 331 534 155.

Another example: \( d = 146\ 097 \), \( f = 4800 \), \( t = 15793 \), \( w = 2^{31} − 1 = 2\ 147\ 483\ 647 \). Then \( \dfrac{w}{f} = \dfrac{2^{31} − 1}{4800} ≈ 447\ 392 \), so we seek a \( P \lt 146\ 097 \lt 447\ 392 \) and an \( R \) as small as possible.

The Extended Algorithm of Euclid (or a search) yields that \( −15188f + 499d = 3 \), and there is no sum of a multiple of \( f \) and a multiple of \( d \) that is closer to 0. It follows that

\begin{align*} φ \| = −15188 \\ δ \| = −499 \\ c \| = 3 \\ P_1 \| = −15188 \bmod \frac{146\ 097}{3} = −15188 \bmod 48699 = 33511 \\ Q_1 \| = −499 − \floorratio{−15188×3}{146\ 097} \frac{4800}{3} = −499 − (−1)×1200 = 1101 \\ R_1 \| = 3 \end{align*}

Let's check:

\[ fP_1 − dQ_1 = 4800×33511 − 146\ 097×1101 = 3 = R_1 \]

For small \( R \) we find the following combinations:

\({k}\) \({R}\) \({P}\) \({Q}\)
1 3 33 511 1101
2 6 67 022 2202
3 9 100 533 3303
4 12 134 044 4404

There are 57132 combinations for which \( X ≥ w \). The combinations with the smallest \( PQR \) are:

\({R}\) \({P}\) \({Q}\) \({PQR}\) \({X}\)
48 487 16 3.74 × 105 2.18 × 1010
9 3135 103 2.91 × 106 7.43 × 1011
96 974 32 2.99 × 106 2.17 × 1010
375 761 25 7.13 × 106 4.35 × 109
144 1461 48 1.01 × 107 2.17 × 1010

We choose \( P = 487 \), then \( Q = 16 \) and \( R = 48 \). We calculate \( y\), \( e \) for \( x = 731\ 767 \). Then

\begin{align*} q \| = \floorratio{731\ 767}{487} = 1502 \\ r \| = ⌊731\ 767⌉_{487} = 293 \\ y \| = 1502×16 + \floorratio{1502×48 + 4800×293 + 15793}{146\ 097} \\ \| = 24032 + \floorratio{1\ 494\ 289}{146\ 097} = 24032 + 10 = 24042 \\ e \| = \dmod{1\ 494\ 289}{146\ 097} = 33319 \end{align*}

The greatest intermediate result is 1 494 289, which is comfortably smaller than \( w \). With the original formula we'd have found

\begin{align*} y \| = \floorratio{4800×731\ 767 + 15793}{146\ 097} = \floorratio{3\ 512\ 497\ 393}{146\ 097} = 24042 \\ e \| = \dmod{3\ 512\ 497\ 393}{146\ 097} = 33319 \end{align*}

which are the same results as before but with the greatest intermediate result equal to 3 512 497 393, which is considerably larger than \( w \).

I've investigated for all \( w \) from 3 through 1024 what the greatest values of \( f \) and \( d \) are for which solutions can be found with \( X ≥ d \) or \( X ≥ w \), and what the greatest \( P \), \( Q \), \( R \), and \( X \) are among those solutions, and what the greatest number \( c \) of such solutions is, and the total count \( N \) of combinations of \( f \) and \( d \) for which there is at least one solution. I find

\begin{align} \max(f_w) \| ≈ \floorratio{w}{4} \\ \max(f_d) \| ≈ \floorratio{w}{3} \\ \max(d_w) \| ≈ w − 5 + ⌊w⌉_2 \\ \max(d_d) \| ≈ w − 1 \\ \max(c_w) \| ≈ \floorratio{w+8}{16} \\ \max(c_d) \| ≈ \floorratio{w−1}{2} \\ \max(P_w) \| ≈ \floorratio{w}{2} − 2 + ⌊w⌉_2 \\ \max(P_d) \| ≈ \floorratio{w}{2} − 1 \\ \max(Q) \| ≈ \floorratio{2\sqrt{w − 1} − 3}{2} \\ \max(R_w) \| ≈ \floorratio{\sqrt{w + 1} − 1}{2} \\ \max(R_d) \| ≈ \frac{\sqrt{w(w + 1100)}}{25} \\ \max(X) \| ≈ \floorratio{w^2}{8} \\ N_w \| ≈ \frac{1}{5}w^{5/3} \\ N_d \| ≈ \frac{1}{3}w^{5/3} \end{align}

where the variables with subscript \( w \) apply only to \( X \gt w \), those with subscript \( d \) apply only to \( X \gt d \), and those without a subscript apply to both. The formulas for \( \max(R_d) \), \( N_w \), and \( N_d \) are approximations; the other formulas are exact for \( 10 ≤ w ≤ 1024 \).

For example, for \( w = 1023 \) I find

\begin{align*} \max(f_w) \| ≈ \floorratio{1023}{4} = 255 \\ \max(f_d) \| ≈ \floorratio{1023}{3} = 341 \\ \max(d_w) \| ≈ 1023 − 5 + ⌊1023⌉_2 = 1019 \\ \max(d_d) \| ≈ 1023 − 1 = 1022 \\ \max(c_w) \| ≈ \floorratio{1023 + 8}{16} = 64 \\ \max(c_d) \| ≈ \floorratio{1023 − 1}{2} = 511 \\ \max(P_w) \| ≈ \floorratio{1023}{2} − 2 + ⌊1023⌉_2 = 510 \\ \max(P_d) \| ≈ \floorratio{1023}{2} − 1 = 510 \\ \max(Q) \| ≈ \floorratio{2×\sqrt{1023 − 1} − 3}{2} ≈ ⌊30.47⌋ = 30 \\ \max(R_w) \| ≈ \floorratio{\sqrt{1023 + 1} − 1}{2} ≈ ⌊15.50⌋ = 15 \\ \max(R_d) \| ≈ \frac{\sqrt{1023 × (1023 + 1100)}}{25} ≈ 58.95 \\ \max(X) \| ≈ \floorratio{1023^2}{8} = 130816 \\ N_w \| ≈ \frac{1}{5}1023^{5/3} ≈ 20772.52 \\ N_d \| ≈ \frac{1}{3}1023^{5/3} ≈ 34620.87 \end{align*}

These values are all correct, except that \( R_d = 59 \), \( N_w = 20014 \), and \( N_d = 33937 \).

If we extrapolate the above formules to \( w = 2^{31} − 1 \) (for values with a width of 32 bits), then we find, approximately

\begin{align*} \max(f_w) \| ≈ 5.4×10^8 \\ \max(f_d) \| ≈ 7.2×10^8 \\ \max(d) \| ≈ 2.1×10^9 \\ \max(c_w) \| ≈ 1.3×10^8 \\ \max(c_d) \| ≈ 1.1×10^9 \\ \max(P) \| ≈ 1.1×10^9 \\ \max(Q) \| ≈ 46340 \\ \max(R_w) \| ≈ 23170 \\ \max(R_d) \| ≈ 8.6×10^7 \\ \max(X) \| ≈ 5.8×10^{17} \\ N_w \| ≈ 7.1×10^{14} \\ N_d \| ≈ 1.2×10^{15} \end{align*}

so if we seek a solution for \( X ≥ w \) (so that we do not need equations \eqref{eq:detour1}ff), then we need try only up to 23170 different values of \( R \). If such a solution does not exist, then we seek a solution for \( X ≥ d \) (for which we do need to use equations \eqref{eq:detour1}ff) and then we must try up to 86 million values of \( R \), which is still much less than the up to 1100 million values of \( P \).

For a given \( w \) there are many combinations of \( d \) and \( f \) for which there are no solutions with \( X ≥ w \) or \( X ≥ d \). For example, for \( w = 499 \) there are only 6554 combinations of \( d \) and \( f \) with at least one solution with \( X ≥ w \), and 10560 combinations with at least one solution with \( X ≥ d \), but there are \( \frac{1}{2} (w − 2)×(w − 3) = 123\ 256 \) combinations with \( 2 ≤ f \lt d \lt w \). The greater \( f \) is, the smaller is the chance that there is a solution for the combination of that \( f \) and an arbitrary \( d \gt f\).

However, when \( f \) and \( d \) are considerably less than \( w \), then there is a good chance of a solution. For example, for \( w = 2^{31} − 1 \) and for \( f \) and \( d \) near \( f ≈ 25920 \) and \( d ≈ 765\ 433 \) there is no solution with \( X ≥ d \) for only 1 out of about 9100 combinations of \( f \) and \( d \), and no solution with \( X ≥ w \) for only 1 out of about 54 combinations.

1.3. The Simple Calendar

For convenience, we'll work with a calendar that has only "days" and "months", where the months are longer than the days, but the formulas also work for other units of time. Later, we'll discuss calendars with more than two time periods.

We'll indicate month numbers using \( m \), day numbers within the month (or within a larger unit of time) with \( d \), and with \( s \) the running day number that is the start or endpoint of the calculation, so they are easy to recognize. If we need multiple month numbers or day numbers then we'll use subscripts, for example \( m_1 \).

1.3.1. From Month and Day Number Within the Month to Running Day Number

In the simplest case, the average length of the month is equal to \( p \) days, and all months are either \( ⌊p⌋ \) or \( ⌊p⌋ + 1 \) days long. We define \( q \) as the length of the short months, and \( ψ \) as the fraction of months that are long. Then

\begin{eqnarray} q \| = \| \dfloor{p} \\ p \| = \| q + ψ \end{eqnarray}

The running day number \( s \) depends on the month number \( m \) and the day number \( d \) within the current month as follows:

\begin{eqnarray} s_0 \| ≡ \| ⌊pm + b⌋ \label{eq:sm} \\ s \| ≡ \| s_0 + d \label{eq:s} \end{eqnarray}

where \( m, d, s, s_0 \) are whole numbers, and \( p ≥ 1 \) and \( b \) are fixed values that depend on the calendar. The first month has \( m = 0 \) and the first day of the month has \( d = 0 \), for easier calculation. \( s_0 \) is the running day number of the beginning of month \( m \).

The first day (\( d = 0 \)) of the first month (\( m = 0 \)) has running day number \( s = 0 \), so

\begin{equation} ⌊b⌋ = 0 ⇔ 0 ≤ b \lt 1 \end{equation}

So \( b \) must be between 0 and 1 (0 is allowed, 1 is not).

1.3.2. Month Length

The length \( L(m) \) of month \( m \) is

\begin{eqnarray} L(m) \| = \| s_0(m + 1) − s_0(m) \notag \\ \| = \| \dfloor{q(m + 1) + ψ(m + 1) + b} − \dfloor{qm + ψm + b} \notag \\ \| = \| q + \dfloor{ψm + ψ + b} − \dfloor{ψm + b} \notag \\ \| = \| q + \dfloor{ψm + b} + C\dparen{\dmod{ψm + b}{1} + ψ ≥ 1} − \dfloor{ψm + b} \eqavide{eq:splitfloor} \notag \\ \| = \| q + C\dparen{\dmod{ψm + b}{1} + ψ ≥ 1} \end{eqnarray}

All months are \( q \) or \( q + 1 \) days long. Month \( m \) is a long month (with \( q + 1 \) days) if \( \dmod{ψx + b}{1} ≥ 1 − ψ \). On average there is a long month after every

\begin{equation} Q = \frac{1}{ψ} \label{eq:Q} \end{equation}

months, but that isn't always a whole number, so in practice the number of months between two successive long months is equal to \( ⌊Q⌋ \) or \( ⌈Q⌉ \).

1.3.3. Shifting the Pattern of Months

With \( b = 0 \) we get a certain pattern of long and short months. Suppose that that pattern would be exactly right if only it were shifted by \( h \) months. So if \( s_0 \) goes with the old calendar (with \( b = 0 \)) and \( s_0' \) goes with the new calendar (with a different value for \( b \)) then we want that the following holds for all values of \( m \):

\begin{eqnarray} s_0'(m + 1) − s_0'(m) \| = \| s_0(m + h + 1) − s_0(m + h) \notag \\ \dfloor{p(m + 1) + b} − \dfloor{pm + b} \| = \| \dfloor{p(m + h + 1)} − \dfloor{p(m + h)} \notag \\ \dfloor{pm + p + b} − \dfloor{pm + b} \| = \| \dfloor{pm + p + ph} − \dfloor{pm + ph} \notag \\ \| = \| \dfloor{pm + p + \dmod{ph}{1}} + \dfloor{ph} − \dparen{\dfloor{pm + \dmod{ph}{1}} + ⌊ph⌋} \notag \\ \| = \| \dfloor{pm + p + \dmod{ph}{1}} − \dfloor{pm + \dmod{ph}{1}} \end{eqnarray}

so we get what we want if

\begin{equation} b = \dmod{ph}{1} \end{equation}

1.3.4. From Running Day Number to Month and Day Number Within the Month

With Equation \eqref{eq:s} we go from running month number \( m \) and day number \( d \) in the month to running day number \( s \). We find \( m \) from \( s \) as follows:

\begin{equation} m = \ceilratio{s + 1 − b}{p} − 1 \label{eq:ξ} \end{equation}

We proceed to prove this. If Equation \eqref{eq:ξ} is valid then we must have

\begin{align} m \| = \ceilratio{s + 1 − b}{p} − 1 \notag \\ \| = \ceilratio{\dfloor{pm + b} + d + 1 − b}{p} − 1 \eqavide{eq:s} \notag \\ \| = \ceilratio{pm + b − \dmod{pm + b}{1} + d + 1 − b}{p} − 1 \eqavide{eq:mod} \notag \\ \| = m + \ceilratio{−\dmod{pm + b}{1} + d + 1}{p} − 1 \end{align}

so the following condition must be met

\begin{eqnarray} 0 \| = \| \ceilratio{d + 1 − \dmod{pm + b}{1}}{p} − 1 \notag \\ 0 \| \lt \| \dfrac{d + 1 − \dmod{pm + b}{1}}{p} \| \le 1 \notag \\ 0 \| \lt \| d + 1 − \dmod{pm + b}{1} \| \le p \end{eqnarray}

so we must have

\begin{equation} 0 \lt d + 1 − \dmod{pm + b}{1} \end{equation}

and

\begin{equation} d + 1 − \dmod{pm + b}{1} \le p \end{equation}

That first condition is met if \( d \ge 0 \), because \( 1 − \dmod{x}{1} \gt 0 \) holds for any \( x \).

The second condition yields

\begin{align} d \| \le p + \dmod{pm + b}{1} − 1 \notag \\ \| = p + pm + b − \dfloor{pm + b} − 1 \eqavide{eq:mod} \notag \\ \| = p(m + 1) + b − \dfloor{pm + b} − 1 \notag \\ \| = \dmod{p(m + 1) + b}{1} + \dfloor{p(m + 1) + b} − \dfloor{pm + b} − 1 \notag \\ \| = \dmod{p(m + 1) + b}{1} + L(m) − 1 \end{align}

so we must have

\begin{equation} d \le \dmod{p(m + 1) + b}{1} + L(m) − 1 \end{equation}

and that condition holds if \( d \) is a whole number and not greater than fits the current month. The current month has length \( L(m) \) and the first day of the current month has \( d = 0 \) so the last day of the current month has \( d = L(m) − 1 \).

So Eq. \eqref{eq:ξ} is valid if \( d \) is a whole number that is not negative and that is less than the length of the current month.

And then we can also find \( d \)

\begin{align} d \| = s − \dfloor{pm + b} \notag \\ \| = s − \dfloor{p \dparen{\ceilratio{s + 1 − b}{p} − 1} + b} \notag \eqavide{eq:ξ} \\ \| = s − \dfloor{p \dparen{\dfrac{s + 1 − b}{p} + \dom1ratio{s + 1 − b}{p} − 1} + b} \notag \eqavide{eq:dom} \\ \| = s − \dfloor{s + 1 − b + p \dom1ratio{s + 1 − b}{p} − p + b} \notag \\ \| = −\dfloor{\ddom{s + 1 − b}{p} − p} − 1 \notag \\ \| = \dceil{p − \ddom{s + 1 − b}{p}} − 1 \eqavide{eq:minusfloor} \end{align}

So, all together,

\begin{align} m \| = \ceilratio{s + 1 − b}{p} − 1 \label{eq:ynaarx2} \\ d \| = \dceil{p − \ddom{s + 1 − b}{p}} − 1 \end{align}

We can rewrite this so we can use the \( \Div \) function. If

\begin{eqnarray} s_1 \| = \| s + 1 − b \\ \{ m_1,d_1 \} \| = \| \Div(−s_1, p) \end{eqnarray}

then

\begin{align} m_1 \| = \floorratio{−s_1}{p} \notag \\ \| = \floorratio{−(s + 1 − b)}{p} \notag \\ \| = −\ceilratio{s + 1 − b}{p} \\ m \| = −m_1 − 1 \\ \| = \ceilratio{s + 1 − b}{p} − 1 \notag \\ d \| = \dceil{p − d_1} − 1 \\ \| = \dceil{p − \dmod{−s_1}{p}} − 1 \notag \\ \| = \dceil{p − \ddom{s_1}{p}} − 1 \notag \\ \| = \dceil{p − \ddom{s + 1 − b}{p}} − 1 \notag \end{align}

An example, with \( p = 30.6 \) and \( b = 0 \). We then find, for the beginning of the first few months

\({m}\) \({pm}\) \({s_0(m)}\) \({L(m)}\)
−1 −30.6 −31 31
0 0 0 30
1 30.6 30 31
2 61.2 61 30
3 91.8 91 31
4 122.4 122 31
5 153 153 30
6 183.6 183 31
7 214.2 214 30
8 244.8 244 31
9 275.4 275 31
10 306 306

Because \( 5p = 153 \) is a whole number, the pattern of month lengths repeats itself after 5 months. We see here the pattern 31-30-31-30-31 that in the Gregorian calendar describes the months March - July and August - December.

Now we go in the opposite direction, for a few running day numbers:

\({s}\) \({s_1}\) \({m_1}\) \({d_1}\) \({m}\) \({d}\)
−2 −1 0 1 −1 29
−1 0 0 0 −1 30
0 1 −1 29.6 0 0
1 2 −1 28.6 0 1
120 121 −4 1.4 3 29
121 122 −4 0.4 3 30
122 123 −5 30 4 0
123 124 −5 29 4 1

1.4. With Whole Numbers Only

Calculating machines often work with a limited number of decimals behind the decimal separator, so you can get into trouble with round-off errors. If \( (s + 1 − b)/p = 6.99999999998 \) but because of a very small round-off error your calculating machine thinks that \( (s + 1 − b)/p = 7.00000000001 \), then your calculating machine thinks that \( \dceil{(s + 1 − b)/p} = 7 \) rather than 6, and then you find the wrong month.

Converting equations with \( ⌈•⌉ \) or \( ⌈•⌋_1 \) into equations with \( ⌊•⌋ \) or \( ⌊•⌉_1 \) or \( \Div \) is easier when only whole numbers are used, because for arbitrary whole numbers \( v \) and \( w \) (\( w \gt 0 \))

\begin{align} \ceilratio{v}{w} \| = \floorratio{v − 1}{w} + 1 \label{eq:ceil2floor} \\ \ddom{v}{w} \| = w − 1 − \dmod{v − 1}{w} \label{eq:ddom2dmod} \end{align}

Proof:

\begin{align*} \ceilratio{v}{w} \| = \floorratio{v}{w} + C(v⊥w) \eqavide{eq:ceilfloor} \\ \| = \floorratio{v}{w} + C\dparen{\dmod{v}{w} \ge 1} \\ \| = \floorratio{v}{w} + C\dparen{\dmod{\dfrac{v}{w}}{1} \ge \dfrac{1}{w}} \\ \| = \floorratio{v}{w} + C\dparen{\dmod{\dfrac{v}{w}}{1} \ge \dmod{\dfrac{1}{w}}{1}} \\ \| = \floorratio{v}{w} − \floorratio{1}{w} + C\dparen{\dmod{\dfrac{v}{w}}{1} − \dmod{\dfrac{1}{w}}{1} \ge 0} \\ \| = \floorratio{v}{w} − \floorratio{1}{w} + 1 − C\dparen{\dmod{\dfrac{v}{w}}{1} − \dmod{\dfrac{1}{w}}{1} \lt 0} \\ \| = \floorratio{v − 1}{w} + 1 \eqavide{eq:floorm} \\ \ddom{v}{w} \| = w\ddom{\dfrac{v}{w}}{1} \\ \| = w\dparen{\dceil{\dfrac{v}{w}} − \dfrac{v}{w}} \eqavide{eq:dom} \\ \| = w\dparen{\floorratio{v − 1}{w} + 1 − \dfrac{v}{w}} \eqavide{eq:ceil2floor} \\ \| = w\dparen{\dfrac{v − 1}{w} − \dmod{\dfrac{v − 1}{w}}{1} + 1 − \dfrac{v}{w}} \eqavide{eq:mod} \\ \| = v − 1 − w\dmod{\dfrac{v − 1}{w}}{1} + w − v \\ \| = w − 1 − \dmod{v − 1}{w} \end{align*}

If the average length \( p \) is a ratio (of whole numbers), then we can avoid such round-off errors by rewriting the formulas based on ratios. We define

\begin{equation} p = \frac{f}{g} \end{equation}

with \( f\), \( g\) whole numbers greater than zero. Then we find, for an arbitrary value \( q \),

\begin{align} \dmod{q}{p} \| = p\dmod{\dfrac{q}{p}}{1} \notag \\ \| = \dfrac{f}{g} \dmod{\dfrac{qg}{f}}{1} \notag \\ \| = \dfrac{1}{g} \dmod{qg}{f} \end{align}

Then we go from month \( m \) and day \( d \) to running day number \( s \) through

\begin{equation} t ≡ bg \end{equation}

\begin{eqnarray} s \| = \dfloor{pm + b} + d \notag \\ \| = \dfloor{\dfrac{fm + bg}{g}} + d \notag \\ \| = \dfloor{\dfrac{fm + t}{g}} + d \end{eqnarray}

where we demand that \( t \) is a whole number, too. Then

\begin{align} m \| = \ceilratio{s + 1 − b}{p} − 1 \notag \\ \| = \ceilratio{s + 1 − (t/g)}{f/g} − 1 \notag \\ \| = \ceilratio{gs + g − t}{f} − 1 \notag \\ \| = \floorratio{gs + g − t − 1}{f} \eqavide{eq:ceil2floor} \\ d \| = \dceil{p − \ddom{s + 1 − b}{p}} − 1 \notag \\ \| = \dceil{(f/g) − \ddom{s + 1 − (t/g)}{p}} − 1 \notag \\ \| = \ceilratio{f − \ddom{gs + g − t}{f}}{g} − 1 \notag \\ \| = \ceilratio{f − \dparen{f − 1 − \dmod{gs + g − t − 1}{f}}}{g} − 1 \eqavide{eq:ddom2dmod} \notag \\ \| = \ceilratio{f − f + 1 + \dmod{gs + g − t − 1}{f}}{g} − 1 \notag \\ \| = \ceilratio{1 + \dmod{gs + g − t − 1}{f}}{g} − 1 \notag \\ \| = \floorratio{\dmod{gs + g − t − 1}{f}}{g} \eqavide{eq:ceil2floor} \end{align}

Summarizing, from running month number \( m \) and day number \( d \) in the month to running day number \( s \):

\begin{equation} s = \floorratio{fm + t}{g} + d \end{equation}

and from \( s \) to \( m \) and \( d \):

\begin{align} s_1 \| = gs + g − t − 1 \\ m \| = \floorratio{s_1}{f} \label{eq:ynaarxr} \\ d \| = \floorratio{\ddom{s_1}{f}}{g} \\ \{m,d_1\} \| = \Div(s_1,f) \\ d \| = \floorratio{d_1}{g} \end{align}

Now you can do all calculations with ratios, which have no numbers after the decimal mark and hence no round-off errors.

For the same calendar as before we have \( p = 30.6 = 153/5, b = 0 \), so \( f = 153, g = 5, t = 0 \). We then find, for the beginning of the first few months

\({m}\) \({s_0 = ⌊fm/g⌋}\) \({L(m)}\)
0 0 30
1 30 31
2 61 30
3 91 31
4 122 31
5 153 30
6 183 31
7 214 30
8 244 31
9 275 31
10 306 30
11 336 31
12 367

Now we go in the opposite direction, for a few running day numbers:

\({s}\) \({s_1}\) \({m}\) \({⌊s_1⌉_f}\) \({d}\)
−2 −6 −1 147 29
−1 −1 −1 152 30
0 4 0 4 0
1 9 0 9 1
120 604 3 145 29
121 609 3 150 30
122 614 4 2 0
123 619 4 7 1

1.5. Very Unequal Months

So far we have assumed that a long month was only one day longer than a short month, but that difference can be larger. Suppose that short months are \( q \) days long and that long months are \( q + r \) days long, with \( q\), \( r \) whole numbers greater than 0, and that a fraction \( ψ \) (between 0 and 1) of all months is long. Then the average length of a month is equal to

\begin{equation} p = q + rψ \end{equation}

days. The formula to calculate the running day number \( s_0 \) of the first day of month \( m \) is then

\begin{equation} s_0 = qm + r\dfloor{ψm + b} \label{eq:sm2} \end{equation}

If we substitute \( r = 1 \) then we find

\begin{eqnarray} s_0 \| = \| qm + \dfloor{ψm + b} \notag \\ \| = \| \dfloor{(q + ψ)m + b} \notag \\ \| = \| \dfloor{pm + b} \end{eqnarray}

which is the same result as Eq. \eqref{eq:sm}.

With Eq. \eqref{eq:sm2}, the length \( L(m) \) of month \( m \) is

\begin{eqnarray} L(m) \| = \| s_0(m+1) − s_0(m) \notag \\ \| = \| q(m + 1) + r\dfloor{ψ(m + 1) + b} − (qm + r\dfloor{ψm + b}) \notag \\ \| = \| q + rC\dparen{\dfloor{ψm + ψ + b} − \dfloor{ψm + b}} \notag \\ \| = \| q + rC\dparen{\ddom{ψm + b}{1} + ψ ≥ 1} \eqavide{eq:splitfloor} \end{eqnarray}

so the long months are those for which \(\ddom{ψm + b}{1} + ψ ≥ 1\), just like we found earlier for the simple calendar.

The formula to calculate the running day number \( s \) from month number \( m \) and day number \( d \) in the current month is then

\begin{eqnarray} s \| = \| s_0 + d \notag \\ \| = \| qm + r⌊ψm + b⌋ + d \label{eq:xnaary3} \end{eqnarray}

How do we go in the opposite direction? To figure that out we compare the running day number that comes from equation \eqref{eq:xnaary3} for the first day (\( d = 0 \)) of month \( m \) with the running day number that comes from that same equation for the same \( m \) and the same average month length \( p \) but with \( r = 1 \) and \( b = 0 \) ― i.e., the corresponding simplest calendar. We write the outcome for the desired calendar as \( s_0 \) and for the simpler comparison calendar with \( r = 1, b = 0 \) as \( s_0' \).

\begin{eqnarray} s_0 \| = \| qm + r\dfloor{ψm + b} \\ s_0' \| = \| \dfloor{(q + rψ)m} = qm + \dfloor{rψm} \\ s_0 − s_0' \| = \| r\dfloor{ψm + b} − \dfloor{rψm} \notag \\ \| = \| r\dparen{ψm + b − \dmod{ψm + b}{1}} − (rψm − \dmod{rψm}{1}) \notag \\ \| = \| rb − r\dmod{ψm + b}{1} + \dmod{rψm}{1} \end{eqnarray}

The difference is certainly greater than \( rb − r \) and certainly less than \( rb + 1 \) (because \( 0 \le b \lt 1\)), and is a whole number (because \( s_0 \) and \( s_0' \) are whole numbers, so their difference is, too).

If \( rb \) is not a whole number then the difference is at least \( \dceil{rb} − r = \dfloor{rb} + 1 − r \). If \( rb \) is a whole number then the difference is at least \( rb − r + 1 = \dfloor{rb} − r + 1\). All in all the difference is at least \( \dfloor{rb} + 1 − r \).

If \( rb \) is not a whole number then the difference is at most \( \dceil{rb} \). If \( rb \) is a whole number then the difference is at most \( rb = \dceil{rb} \). All in all the difference is at most \( \dceil{rb} \).

The beginning of month \( m \) in the target calendar is between \( \dfloor{rb} + 1 − r \) and \( \dceil{rb} \) days after the beginning of month \( m \) in the simple calendar.

For example, let \( q = 30, ψ = 0.12, r = 5, b = 0.1 \). Then \( p = q + rψ = 30.6 \) is the average length of a month. We find for the first 10 months

\({m}\) \({s_0}\) \({s_0'}\) \({s_0 − s_0'}\)
0 0 0 0
1 30 30 0
2 60 61 −1
3 90 91 −1
4 120 122 −2
5 150 153 −3
6 180 183 −3
7 210 214 −4
8 245 244 1
9 275 275 0

and \( s_0 − s_0' \) varies between \( \dfloor{rb} + 1 − r = 0 + 1 − 5 = −4 \) and \( \dceil{rb} = 1 \) as expected.

For that simpler calendar we have Equation \eqref{eq:ynaarx2} to calculate the month number from the running day number. If we apply that formula to

\[ s − (\dfloor{rb} + 1 − r) = s − \dfloor{rb} + r − 1 \]

then we are sure to find a month number that is greater than or equal to the correct month number. And if we apply that formula to

\[ s − \dceil{rb} \]

then we are sure to find a month number that is less than or equal to the correct month number.

\begin{align} m_\text{lower} \| ≤ m ≤ m_\text{upper} \label{eq:ondbov3} \\ m_\text{lower} \| ≡ \ceilratio{s + u_\text{lower}}{p} − 1 \label{eq:ynaarx3} \\ m_\text{upper} \| ≡ \ceilratio{s + u_\text{upper}}{p} − 1 \\ u_\text{lower} \| ≡ 1 − \dceil{(r − 1)b} \\ u_\text{upper} \| ≡ r − \dfloor{(r − 1)b} \end{align}

For the calendar from the previous example we find

\begin{eqnarray*} u_\text{lower} \| = 1 − \dceil{(r − 1)b} \| = −0.1 \\ u_\text{upper} \| = r − \dfloor{(r − 1)b} \| = 4.9 \end{eqnarray*}

\({s}\) \({m}\) \({s+u_\text{lower}}\) \({(s+u_\text{lower})/p}\) \({m_\text{lower}}\) \({s+u_\text{upper}}\) \({(s+u_\text{upper})/p}\) \({m_\text{upper}}\)
−5 −1 −5.1 −0.167 −1 −0.1 −0.003 −1
−4 −1 −4.1 −0.134 −1 0.9 0.029 0
0 0 −0.1 −0.003 −1 4.9 0.160 0
1 0 0.9 0.029 0 5.9 0.193 0
148 4 147.9 4.833 4 152.9 4.997 4
149 4 148.9 4.866 4 153.9 5.029 5
150 5 149.9 4.899 4 154.9 5.062 5
153 5 152.9 4.997 4 157.9 5.160 5
154 5 153.9 5.029 5 158.9 5.193 5
209 6 208.9 6.827 6 213.9 6.990 6
210 7 209.9 6.859 6 214.9 7.023 7
214 7 213.9 6.990 6 218.9 7.154 7
215 7 214.9 7.023 7 219.9 7.186 7

and there indeed \( m_\text{lower} ≤ m ≤ m_\text{upper} \).

If we use \( m_\text{upper} \) as estimate for the month number in the target calendar then that can be too high but not too low. If we use that to calculate the day number within the month then we find

\begin{align} s_{0\text{upper}} \| = qm_\text{upper} + r⌊ψm_\text{upper} + b⌋ \\ d_\text{upper} \| = s − s_{0\text{upper}} \end{align}

and then also \( s_{0\text{upper}} \) can be too high, and then \( d_\text{upper} \lt 0 \). So if \( d_\text{upper} \lt 0 \) then \( m \lt m_\text{upper} \).

If \( r \lt p \) then \( m_\text{upper} \) is at most 1 greater than \( m_\text{lower} \), and also at most 1 greater than \( m \). We can use this to find a recipe with a fixed number of steps for calculating \( d \):

\begin{align} s_{0\text{upper}} \| = qm_\text{upper} + r⌊ψm_\text{upper} + b⌋ \\ d_\text{upper} \| = s − s_{0\text{upper}} \\ ζ \| = \floorratio{d_\text{upper}}{q + r} \\ m \| = m_\text{upper} + ζ \label{eq:xζ3} \\ s_0 \| = qm + r⌊ψm + b⌋ \\ d \| = s − s_0 = s − qm − r⌊ψm + b⌋ \end{align}

Let \( q = 5, r = 2, ψ = 8/15, b = 1/15 \). Then

\begin{eqnarray*} p \| = q + rψ = 5 + 2×\dfrac{8}{15} = \dfrac{91}{15} \\ u_\text{lower} \| = 1 − \dceil{(r − 1)b} = 1 − \dceil{1×\dfrac{1}{15}} \| = 0 \\ u_\text{upper} \| = r − \dfloor{(r − 1)b} = 2 − \dfloor{1×\dfrac{1}{15}} \| = 2 \end{eqnarray*}

Then also \( r \lt p \), so equation \eqref{eq:xζ3} can be used.

The running day number \( s \) of the first day of month number \( m = 37 \) is then (from equation \eqref{eq:xnaary3})

\[ s = qm + r⌊ψm + b⌋ = 5×37 + 2×\left\lfloor \frac{8}{15}×37 + \frac{1}{15} \right\rfloor = 185 + 2×\floorratio{99}{5} = 223 \]

Now we calculate the month that corresponds to running day number \( s = 223 \). Then

\begin{eqnarray*} m_\text{upper} \| = \ceilratio{s + u_\text{upper}}{p} − 1 \\ \| = \dceil{\dfrac{223 + 2}{91/15}} − 1 = 37 \end{eqnarray*}

so the month number has an upper limit of 37. We don't need the lower limit \( m_\text{lower} \) for further calculations, but for this example we calculate it anyway:

\begin{eqnarray*} m_\text{lower} \| = \ceilratio{s + u_\text{lower}{}}{p} − 1 \\ \| = \dceil{\dfrac{223}{91/15}} − 1 = 36 \end{eqnarray*}

so the month number can be 36 or 37. With \( m_\text{upper} \) we find

\begin{align*} s_\text{upper} \| = 223 \\ d_\text{upper} \| = s − s_\text{upper} = 223 − 223 = 0 \\ ζ \| = 0 \\ m \| = m_\text{upper} = 37 \\ d \| = d_\text{upper} = 0 \end{align*}

And here is another example. With \( q = 3, r = 2, ψ = 62/235, b = 0 \) we calculate which month corresponds to running day number \( s = 1448 \). Then \( p = q + rψ = 3 + 2×62/235 = 829/235 ≥ 2 = r \) so we can use equation \eqref{eq:xζ3}. Then

\begin{align*} u_\text{lower} \| = 1 − \dceil{(2 − 1)×0} = 1 \\ u_\text{upper} \| = 2 − \dfloor{(2 − 1)×0} = 2 \\ m_\text{lower} \| = \dceil{(1448 + 1)/(829/235)} − 1 = 410 \\ m_\text{upper} \| = \dceil{(1448 + 2)/(829/235)} − 1 = 411 \end{align*}

so the month number can be 410 or 411. With \( m_\text{upper} \) we find

\begin{align*} s_\text{upper} \| = 3×411 + 2×\dfloor{\dfrac{62}{235}×411 + 0} = 1449 \\ d_\text{upper} \| = s − s_\text{upper} = 1448 − 1449 = −1 \\ ζ \| = \floorratio{d_\text{upper}}{q + r} = \floorratio{−1}{5} = −1 \\ m \| = m_\text{upper} + ζ = 410 \\ d \| = s − s_0 = 1448 − 3×410 − 2×\dfloor{\dfrac{62}{235}×410 + 0} = 2 \end{align*}

so \( s = 1448 \) corresponds to day \( d = 2 \) in month \( m = 410 \).

If\( p = f/g = q + rh/g \) and \( b = t/g \) are ratios of whole numbers (\( f, g, q, r, h, t \) are whole numbers), then we find

s₀ = qm + r⌊(hm+t)/g⌋ u_up = s + r − ⌊(r − 1)t/g⌋ m_up = ⌈(s + u_up)g/f⌉ − 1 s₀up = d_up = s − s₀up ζ = ⌊d_up/(q + r)⌋

x + ⌊y − x⌉_z = x + (y − x − z⌊(y − x)/z⌋) = y − z⌊(y − x)/z⌋

\begin{align} s \| = s_0 + d = qm + r\floorratio{hm + t}{g} + d \label{eq:xnaary3r} \\ u_\text{upper} \| = r − \floorratio{(r − 1)t}{g} \\ m_\text{upper} \| = \ceilratio{(s + u_\text{upper})g}{f} − 1 \notag \\ \| = \floorratio{(s + u_\text{upper})g − 1}{f} \eqavide{eq:ceil2floor} \notag \\ \| = \floorratio{\dparen{s + r − \floorratio{(r − 1)t}{g}}g − 1}{f} \notag \\ \| = \floorratio{gs + gr − g\floorratio{(r − 1)t}{g} − 1}{f} \notag \\ \| = \floorratio{gs + gr − ((r − 1)t − \dmod{r − t}{g}) − 1}{f} \\ \| = \floorratio{gs + gr − rt + t + \dmod{r − t}{g} − 1}{f} \end{align}

\begin{align} \\ ... \\ m_\text{upper} \| = \floorratio{gs + rg − rt − 1}{f} \label{eq:ynaarx3r} \\ s_\text{upper} \| = qm_\text{upper} + r\floorratio{hm_\text{upper} + t}{g} \\ d_\text{upper} \| = s − s_\text{upper} \\ ζ \| = \floorratio{d_\text{upper}}{q + r} \\ m \| = m_\text{upper} + ζ \\ d \| = s − s_1 = s − q \end{align}



[AA]

languages: [en] [nl]

//aa.quae.nl/en/reken/juliaansedag.html;
Last updated: 2021-08-12