Course notes (chap. 1 Number Theory, chap. 2 ... - McGill University
Course notes (chap. 1 Number Theory, chap. 2 ... - McGill University
Course notes (chap. 1 Number Theory, chap. 2 ... - McGill University
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
1.2 Efficient operations<br />
For the basic operations of +, −, ×, mod , div one may use standard “elementary<br />
school” algorithms reducing the work load by the following rules:<br />
a<br />
⎧<br />
⎨<br />
⎩<br />
+<br />
−<br />
×<br />
⎫<br />
⎬<br />
⎭ b mod n = ⎛<br />
⎝(a mod n)<br />
⎧<br />
⎨<br />
⎩<br />
+<br />
−<br />
×<br />
⎫<br />
⎬<br />
⎭ (b mod n) ⎞<br />
⎠ mod n<br />
The standard “elementary school” algorithms are precisely described in<br />
Knuth (Vol 2). For very large numbers, special purpose divide-and-conquer<br />
algorithms may be used for better efficiency of ×,mod, div. Consult the<br />
algorithmics book of Brassard-Bratley for these.