Skip to content

Commit a82f445

Browse files
authored
Add CRT inductive solution
1 parent d1d7a59 commit a82f445

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/algebra/chinese-remainder-theorem.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ $$a = a_1 n_2 m_2 + a_2 n_1 m_1$$
5858

5959
We can easily verify $a = a_1 (1 - n_1 m_1) + a_2 n_1 m_1 \equiv a_1 \pmod{m_1}$ and vice versa.
6060

61+
## Solution for General Case
62+
63+
### Inductive Solution
64+
65+
As $m_1 m_2$ is coprime to $m_3$, we can inductively repeatedly apply the solution for two moduli for any number of moduli. For example, combine $a \equiv b_2 \pmod{m_1 m_2}$ and $a \equiv a_3 \pmod{m_3}$ to get $a \equiv b_3 \pmod{m_1 m_2 m_3}$, etc.
66+
67+
6168
## Garner's Algorithm
6269

6370
Another consequence of the CRT is that we can represent big numbers using an array of small integers. For example, let $p$ be the product of the first $1000$ primes. From calculations we can see that $p$ has around $3000$ digits.

0 commit comments

Comments
 (0)