This preview shows pages 1–8. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: 181ICS 141: Discrete Mathematics I (Spr 2008)University of HawaiiICS141: Discrete Mathematics for Computer Science IDepartment of Information and Computer SciencesUniversity of HawaiiStephen Y. Itoga182ICS 141: Discrete Mathematics I (Spr 2008)University of HawaiiLecture 18Chapter 3. The Fundamentals3.7 Applications of Number Theory3.8 Matrices183ICS 141: Discrete Mathematics I (Spr 2008)University of HawaiiSome material in these slides were taken/adapted from the slides made by Prof. Michael P. Frank and Prof. Jonathan L. Gross which are provided through the publisher of “Discrete Mathematics and Its Applications” written by Kenneth H. Rosen.Some slides were done by Prof. Baek184ICS 141: Discrete Mathematics I (Spr 2008)University of HawaiiChinese Remainder TheoremTheorem:(Chinese remainder theorem.) Let m1,…,mnbe pairwise relatively prime and ai ,…,anarbitrary integers. Then the system of equations x≡ ai(mod mi)(for i=1 to n) has a unique solution modulo m= m1 m2···mn.Proof:185ICS 141: Discrete Mathematics I (Spr 2008)University of HawaiiComputer Arithmetic w. Large IntsBy Chinese Remainder Theorem, an integer awhere 0≤a<m=∏mi, gcd(mi,mj≠i)=1, can be represented by a’s residues mod mi:(amod m1, amod m2, …, amod mn) To perform arithmetic upon large integers represented in this way, Simply perform ops on these separate residues!Each of these might be done in a single machine op.The ops may be easily parallelized on a vector machine.186ICS 141: Discrete Mathematics I (Spr 2008)University of HawaiiComputer Arithmetic ExampleFor example, the following numbers are relatively prime:m1= 225−1 = 33,554,431 = 31 · 601 · 1,801m2= 227−1 = 134,217,727 = 7 · 73 · 262,657m3= 228−1 = 268,435,455 = 3 · 5 · 29 · 43 · 113 · 127m4= 229−1 = 536,870,911 = 233 · 1,103 · 2,089m5= 231−1 = 2,147,483,647 (prime)Thus, we can uniquely represent all numbers up to m= ∏mi≈ 1.4×1042≈ 2139.5by their residues rimodulo these five mi.E.g.,1030= (r1= 20,900,945; r2= 18,304,504; r3= 65,829,085; r4= 516,865,185; r5= 1,234,980,730)To add two such numbers in this representation, Just add their corresponding residues using machinenative 32bit integers. Take the result mod 2k−1: If result is ≥ the appropriate 2k−1 value, subtract out 2k−1or just take the low kbits and add 1.Note: No carries are needed between the different pieces!187ICS 141: Discrete Mathematics I (Spr 2008)University of HawaiiPseudoprimesAncient Chinese mathematicians noticed that whenever nis prime, 2n−1≡1 (mod n).Some also claimed that the converse was true.However, it turns out that the converse is not true!...
View
Full
Document
This note was uploaded on 09/12/2008 for the course ICS 141 taught by Professor Idk during the Fall '08 term at Hawaii.
 Fall '08
 IDK

Click to edit the document details