diff --git a/abstract-algebra-charles-pinter-notes.pdf b/abstract-algebra-charles-pinter-notes.pdf index 79c8aef..a4f2f4c 100644 Binary files a/abstract-algebra-charles-pinter-notes.pdf and b/abstract-algebra-charles-pinter-notes.pdf differ diff --git a/abstract-algebra-charles-pinter-notes.tex b/abstract-algebra-charles-pinter-notes.tex index d55e420..6c2c2f1 100644 --- a/abstract-algebra-charles-pinter-notes.tex +++ b/abstract-algebra-charles-pinter-notes.tex @@ -285,7 +285,7 @@ Quotient group construction is useful as a way of actually manufacturing all the \section{Rings} \begin{definition}[Ring] - A set $A$ with operations called \emph{addition} and \emph{multiplication} which satisfy the following axions: + A set $A$ with operations called \emph{addition} and \emph{multiplication} which satisfy the following axioms: \begin{enumerate}[i.] \item $A$ with addition alone is an abelian group. \item Multiplication is associative. @@ -348,7 +348,7 @@ Every field is an integral domain, but the converse is not true (eg. $\mathbb{Z} If there is no such positive integer $n$, $A$ has characteristic $0$. \end{definition} -\section{Factoring into primes} +\section{Elements of number theory} \begin{definition}[Euclid's lemma] Let $m$ and $n$ be integers, and let $p$ be a prime. If $p|(mn)$, then either $p|m$ or $p|n$. @@ -366,9 +366,6 @@ Every field is an integral domain, but the converse is not true (eg. $\mathbb{Z} From the last two theorems: every integer $m$ can be factored into primes, and the prime factors of $m$ are unique (except for the order). - -\section{Elements of number theory} - \begin{theorem}[Little theorem of Fermat] Let $p$ be a prime. Then, $$a^{p-1} \equiv 1 \pmod p, \forall a \not\equiv 0 \pmod p$$ @@ -381,7 +378,7 @@ From the last two theorems: every integer $m$ can be factored into primes, and t \end{theorem} \begin{theorem}[Euler's theorem] - If $a$ and $n$ are relatively prime, $a^{\phi(n)} \equiv 1 \pmod n$. + If $a$ and $n$ are relatively prime, $$a^{\phi(n)} \equiv 1 \pmod n$$ \end{theorem} diff --git a/number-theory.sage b/number-theory.sage index 1340123..d7928c4 100644 --- a/number-theory.sage +++ b/number-theory.sage @@ -1,8 +1,12 @@ # Chinese Remainder Theorem -def crt(a_i, m_i, M): +def crt(a_i, m_i): if len(a_i)!=len(m_i): raise Exception("error, a_i and m_i must be of the same length") + M=1 + for i in range(len(m_i)): + M = M * m_i[i] + x = 0 for i in range(len(a_i)): M_i = M/m_i[i] diff --git a/number-theory_test.sage b/number-theory_test.sage index 6709f3a..8011de5 100644 --- a/number-theory_test.sage +++ b/number-theory_test.sage @@ -4,13 +4,11 @@ load("number-theory.sage") # Chinese Remainder Theorem tests a_i = [5, 3, 10] m_i = [7, 11, 13] -M = 1001 -assert crt(a_i, m_i, M) == 894 +assert crt(a_i, m_i) == 894 a_i = [3, 8] m_i = [13, 17] -M = 221 -assert crt(a_i, m_i, M) == 42 +assert crt(a_i, m_i) == 42 #####