# solve modular arithmetic equation

How do I solve this equation

$$L = D + [D:4]$$

• $$L$$ is a known integer obtained previously;
• $$D$$ is an integer;
• $$[D:4]$$ is the quotient part of ($$D/4$$.)

At first glance, I did not know how to solve this equation as I have never seen this type in my calculus studies. After searching online I found that this is modular arithmetic for two reasons:

1. The original relation is a congruence equation (Zeller's Rule) dealing with cyclical calendar numbers and I understand that modular arithmetic deals with cyclical integers.
2. $$D/4=quotient(D/4)+remainder (D/4)$$ and since $$D \pmod 4=remainder(D /4)$$ that also means we are dealing with modular arithmetic.

$$∴ [D:4]=D/4-D \pmod 4$$

$$∴ L=5/4 D-D \pmod 4 ……………….. (1)$$

how to go further with eq. (1)?

Although I read the modular arithmetic rules and practiced a little but I wasn’t sure if I was going the right path. I tried to eliminate the $$D \pmod 4$$ part by multiplying it with its inverse according to the following rule:

Calculate $$A \cdot D \pmod 4$$ for $$A$$ values $$0$$ through $$(4-1)$$, the modular inverse of $$\pmod 4$$ is the $$A$$ value that makes $$A \cdot D\equiv 1\pmod 4$$ and only the numbers that share no prime factors with $$4$$ have a modular inverse $$\pmod 4$$

From this point, I can obtain an inverse (I think) but It makes no sense to me.

If $$D = 4q + r$$, you've already acheived $$L = \frac{5D}{4} + r = 5q + \frac{9r}{4} \implies \frac{9r}{4} = L - 5q \in \Bbb N$$. Since $$\rm{gcd}(9,4) = 1$$, $$4|r\, \land \, 0 \leq r < 4 \implies r = 0$$. So $$D = \frac{4L}{5}$$, given the restrictions.
• why $D=4q+r$ and not $D=4q+4r$ – Ali_R4v3n Dec 15 '18 at 19:21
• I'm assuming the Euclidean division of $D$ by $4$, with quotient $q$ and remainder $r$. – Lucas Henrique Dec 15 '18 at 21:00