Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Number Theory

vici
November 25, 2013

Number Theory

vici

November 25, 2013
Tweet

More Decks by vici

Other Decks in Programming

Transcript

  1. Ä ún Theorem (ûS K(Well Ordering Principle)) z‡g,ê8Ü¥Ñk˜‡• Š" Theorem

    (k•8B K(Finite Induction)) N´g,ê8ܧ S•N ˜‡f8Ü" XJSÎܱeü:µ • S¥•¹0" • XJêikáuS§@ok + 1•áuS" @oS = N vici Number Theory
  2. Ø5Ú ê Definition d | a L«é,‡ êk§ka = kd"

    d a L«é?¿ êk§Ãa = kd" Property • 0Œ ?Û£š0¤ ê Ø" • eb | a§K±b | ±a" • ea | b, b | c§Ka | c" • ea | ai, i = 1, 2, 3, ..., k§Ka | (c1a1 + c2a2 + ... + ckak)§ ùpc1...k •?¿ ê" • ep•ƒê…p | ab§Kp | a½p | b" vici Number Theory
  3. Ø5Ú ê Definition XJd | a¿…d ≥ 0§K·‚`d´a ê" z‡

    êaÑŒ± Ù²… ê1Úa اa š²… ê•¡ •a Ïf" Example 20 Ïfk2§4§5§10" vici Number Theory
  4. •˜©)½n Theorem (‘{Ø{½n) a, b ∈ Z, b = 0§K•3•˜

    êéqÚr§¦a = qb + r, 0 ≤ r < |b|§r¡•bØa¤ • • • • • •{ { {" Theorem (•˜©)½n) ?˜g,ên Œ•˜L•ƒêƒÈ n = pa1 1 pa2 2 ...pak k p1 < p2 < ... < pk •ƒê§a1, a2, . . . , ak •g,ê" Example 1620 = 22 · 34 · 5 vici Number Theory
  5. A‡êؼê Definition (¼ê[x]) x´¢ê§ØŒux •Œ ê¡•x êÜ©§P•[x]¶ x − [x]¡•x

    êÜ©§P•{x}" Property • epa n!§Ka = [n p ] + [ n p2 ] + [ n p3 ] + ... Example (¦100!• ëY0 ‡ê) du100!¥2 ‡êŒu5 ‡ê§¤±100!¥5 gê=•(J a = 100 5 + 100 52 + ... = 20 + 4 = 24 vici Number Theory
  6. A‡êؼê Definition (¼êd (n)) ên Ïê‡ê¡•Ø{¼ê"en IO©)ª •n = pa1

    1 pa2 2 ...pas s §K|^¦{ n µ d (n) = (a1 + 1) (a2 + 1) ... (an + 1) Example (72 Ïf‡ê) d (72) = d 23 · 32 = (3 + 1) (2 + 1) = 12 vici Number Theory
  7. A‡êؼê Definition (î.¼êϕ (n)) ên†1, ..., n − 1pƒ ê

    ‡ê¡•n î.¼ê§P •ϕ (n)"en IO©)ª•n = pa1 1 pa2 2 ...pas s §Kϕ (n) OŽú ª•µ ϕ(n) = pa1−1 1 pa2−1 2 ...pas−1 s (p1 − 1)(p2 − 1)...(ps − 1) Example (1 − 1999¥†2000pƒ ê ‡ê) ϕ (2000) = ϕ 24 · 53 = 23 · 52 (2 − 1) (5 − 1) = 800 vici Number Theory
  8. Ó{9ÙÄ 5Ÿ Ó{ Vg´pd£Gauss¤31800c†m‰Ñ Definition m´ ê§e^m Ø êa§b§¤ {êƒÓ§K

    ¡a†b'u mÓ{§PŠa ≡ b (modm)¶ÄK¡a†b'u mØÓ{§PŠa ≡ b (modm)" Example 34 ≡ 4 (mod15) 1000 ≡ −1 (mod7) 34 ≡ 4 (mod8) vici Number Theory
  9. Ó{9ÙÄ 5Ÿ Property 1 a ≡ b (modm) ¿‡^‡´a =

    b + mt, t ∈ Z§•=m | a − b Example (ò Ø'X=C•Ó{ª) a ≡ b (modm) ↔ a − b ≡ 0 (modm) ↔ m | a − b • 7 ≡ 4 (mod3) ↔ 3 | (7 − 4) Property 2 Ó{'X÷ve 5Ƶ • g‡Æµé?Û mÑka ≡ a (modm) • é¡Æµea ≡ b (modm)§Kb ≡ a (modm) • D4Ƶea ≡ b (modm)§b ≡ c (modm)§Ka ≡ c (modm) vici Number Theory
  10. Ó{9ÙÄ 5Ÿ Property 3 eai ≡ bi (modm) , i

    = 1, 2, ..., s§K a1 + a2 + ... + as ≡ b1 + b2 + ... + bs (modm) íص k´ ê§n´ ê • ea + b ≡ c (modm)§Ka ≡ b − c (modm) • ea ≡ b (modm)§ Ka + mk ≡ a (modm) , ak ≡ bk (modm) , an ≡ bn (modm) Conclusion 5Ÿ39íØL²§éu\!~!¦9¦• ó§Ó{ª† ª $Ž5Æ´˜— µŒ±£‘§Œ±Ó¦˜ ꧕Œ±¦• vici Number Theory
  11. Ó{9ÙÄ 5Ÿ Property 4 f (x)´Xê • ê õ‘ª§ea +

    b ≡ c (modm)§K f (a) ≡ f (b) (modm) Example (Á¦ 25733+46 26 50ؤ {ê) • 25733 + 46 26 ≡ 733 + 46 26 (mod50) • 733 + 46 26 ≡ 72 16 × 7 + 46 26 (mod50) ≡ (−1)16 × 7 + 46 26 (mod50) ≡ 326 (mod50) • 326 ≡ 35 5 × 3 ≡ −75 × 3 ≡ − 72 2 × 7 × 3 ≡ −21 ≡ 29 (mod50) • 5¿ 0 ≤ 29 < 50§¤±29Ò´¤¦{ê vici Number Theory
  12. Ó{9ÙÄ 5Ÿ Property 5 ead ≡ bd (modm)§…(d, m) =

    1§Ka ≡ b (modm) Property 6 ea ≡ b (modm)§…d | a§d | b§d | m§Ka d ≡ b d mod m d Property 7 ea ≡ b (modm)§…m1 | m§Ka ≡ b (modm1) Property 8 ea ≡ b (modmi) , i = 1, 2, ..., s§Ka ≡ b(mod [m1, m2, ..., ms] vici Number Theory
  13. ú ê!ú ê9pƒ Definition ú ꧽ¡/úÏê0 "XJ˜‡ êÓž´A‡ ê ê§

    ¡ù‡ ꕧ‚ ú ê" ú ꥕Œ ¡••Œú ê£Greatest Common Divisor§ GCD¤ " Property é?¿ eZ‡ ê§1o´§‚ ú ê" Definition XJü‡ êa†b=kú ê1§=XJgcd (a, b) = 1§Ka†b¡ •pŸê" Property é ? ¿ êa§ bÚp§ X Jgcd (a, p) = 1…gcd (b, p) = 1§ Kgcd (ab, p) = 1" vici Number Theory
  14. ú ê!ú ê9pƒ Property • gcd (a, 0) = gcd

    (a, ka) = |a| • gcd (a, 1) = |1| • gcd (a, b) = gcd (b, a) = gcd (−a, b) Theorem XJaÚb´ØÑ•0 ?¿ ê§Kd = gcd (a, b)´a†b ‚5 |Ü8Ü{ax + by : x, y ∈ Z}§kd = ax + by" Inference • é?¿ êaÚb§XJd | a¿…d | b§Kd | gcd (a, b)" • é¤k êaÚb±9?¿šK ên§ gcd (an, bn) = n · gcd (a, b)" • é¤k ên§aÚb§XJn | ab¿…gcd (a, n) = 1§ Kn | b" vici Number Theory
  15. ú ê!ú ê9pƒ Definition ü‡½ü‡±þ êúk ê ‰ùA‡ê ú ê§Ù¥•

    ˜‡ ‰ùA‡ê • ú ê£Least Common Multiple§ LCM¤ " Property • gcd (a, b) · lcm (a, b) = ab • ü‡ ê •Œú êÚ• ú ꥕3© Ƶ gcd (a, lcm (b, c)) = lcm (gcd (a, b) , gcd (a, c)) lcm (a, gcd (b, c)) = gcd (lcm (a, b) , lcm (a, c)) vici Number Theory
  16. •Œú ê Methods • üꈩ)ŸÏf§, ÑƒÓ ‘¦å5 • Î=ƒØ{ Theorem

    (GCD48½n) é?¿šK êaÚ?¿ êbk gcd (a, b) = gcd (b, a mod b) vici Number Theory
  17. •Œú ê Proof (GCD48½n). • gcd (a, b) | gcd

    (b, a mod b) d = gcd (a, b)§Kd | a…d | b q = a b §Ka mod b = a − qb dd | ax + by§ d | (a mod b) ¤±d | gcd (b, a mod b) • gcd (b, a mod b) | gcd (a, b) d = gcd (b, a mod b) Kd | b…d | (a mod b) q = a b §Ka = qb + (a mod b) d | a ¤±d | gcd (b, a mod b) Ïd gcd (a, b) = gcd (b, a mod b) vici Number Theory
  18. îAp Ž{ Definition îAp £ ú c300c F1ͶêÆ[¤ 5AÛ 6

    £ã e GCDŽ{" • E,Ý O (log b)) Algorithm EUCLID (a, b) if b = 0 then return a else return EUCLID (b, a mod b) vici Number Theory
  19. *ÐîAp Ž{ Definition Šâd = gcd (a, b) = ax

    + by§@oExtended-EuclidŽ{òÏL˜ éšK ꈣ˜‡n ª(d, x, y)" • (E,݆ECULIDÄ ƒÓ) Algorithm EXTENDED−EUCLID(a, b) if b = 0 then return(a, 1, 0) (d , x , y ) = EXTENDED−EUCLID(b, a mod b) (d, x, y) = (d , y , x − [a / b] · y ) return(d, x, y) vici Number Theory
  20. *ÐîAp Ž{ Proof (d = ax + by). • eb

    = 0 -x = 1, y = 0§K÷va = 1 · a + 0 · b • eb = 0 K d = gcd (b, a mod b) d = bx + (a mod b) y d = gcd (a, b) = d = gcd (b, a mod b) d = bx + (a − [a/b] b) y = a y +b(x − [a/b] y ) - x = y y = x − [a/b] y K÷vd = ax + by vici Number Theory
  21. $Ž Definition (k•+) +(S, ⊕)´˜‡8ÜSÚ½Â3Sþ ?›$Ž⊕" Property • µ45µé¤ka, b

    ∈ S§ka ⊕ b ∈ S" • ü µ•3˜‡ ƒe ∈ S§¡•+ ü §÷vé¤ ka ∈ S§e ⊕ a = a ⊕ e = a" • (ÜƵé¤ka, b, c ∈ S§k(a ⊕ b) ⊕ c = a ⊕ (b ⊕ c)" • _ µ éz‡a ∈ S§•3•˜ ƒb ∈ S§¡•a _ § ÷va ⊕ b = b ⊕ a = e" Definition ( †+) XJ+(S, ⊕)÷v †Æ§é¤ka, b ∈ S§ka ⊕ b = b ⊕ a §K §´˜‡ †+" vici Number Theory
  22. .‚KF½n9f+ Definition (k•Œ †+) ½Â \{+(Zn, +n)§5 •|Zn| = n"

    ½Â ¦{+(Z∗ n , ·n)§T+ ƒ•Zn ¥†npƒ ƒ|¤ 8ÜZ∗ n µ Z∗ n = {[a]n ∈ Zn : gcd (a, n) = 1} Zn †Z∗ n Ñ´k•Œ †+" Definition (f+) ˜‡k•+ š˜µ4f8´˜‡f+" Property XJ(S, ⊕)´˜‡k•+§S ´S ˜‡?¿š˜f8§¿÷v é¤ka, b ∈ S §ka ⊕ b ∈ S §K(S , ⊕)´(S, ⊕) ˜‡f+" vici Number Theory
  23. .‚KF½n9f+ Definition (.‚KF½n) XJ(S, ⊕)´˜‡k•+§(S , ⊕)´(S, ⊕) ˜‡f+§ K|S

    |´|S| ˜‡ ê" • 阇+S f+S §XJS = S§Kf+S ¡•+S ýf+" Inference XJS.´k•+S ýf+§K|S | ≤ |S| 2 " Definition ék ≥ 1½Âa(k)Xeµ a(k) = a ⊕ a ⊕ ... ⊕ a £k‡a¤ 3+Zn ¥§ka(k) = ka mod n¶3+Z∗ n ¥§ka(k) = ak mod n" da)¤ f+^ a ½( a , ⊕)L«§Ù½ÂXeµ a = a(k) : k ≥ 1 +S¥a d^ord (a)L«§½Â•÷va(t) ≡ e • êt" vici Number Theory
  24. .‚KF½n9f+ Example (3+{0, 2, 4, 6......}¥) ˜‡f+•{0, 4, ......}" Example

    (3Z6 ¥) 0 = {0} 1 = {1, 2, 3, 4, 5} 2 = {0, 2, 4} Example (Z∗ 7 ) 1 = {1} 2 = {1, 2, 4} 3 = {1, 2, 3, 4, 5, 6} vici Number Theory
  25. ¦) ‚5•§ Definition (•Ä¦)e •§ ¯Kµ) ax ≡ b (modn)

    £Ù¥a > 0, n > 0¤ Theorem 1 é?¿ êaÚn§XJd = gcd (a, n)§K 3Zn ¥ a = d = 0, d, 2d, ..., n d − 1 d §Ïdk| a | = n d " Example (3 mod 5) 3 = gcd (3, 5) = 1 1 = 1(x) mod 5 (x = 0, 1, 2, 3, 4) = {0, 1, 2, 3, 4} vici Number Theory
  26. ¦) ‚5•§ Proof (Theorem 1). • d ⊆ a Ï•ax

    + ny = d Kax ≡ d (modn) ¤±d ∈ a §Óž(kd mod n) ∈ a " = d ⊆ a • a ⊆ d m ∈ a m = ax mod n Kkm = ax + ny Ï•d | a…d | n§Kkd | m ¤±m ∈ d §? a ⊆ d vici Number Theory
  27. ¦) ‚5•§ Theorem 1. Inference • •§ax ≡ b (modn)éu™•þxk)§

    …= gcd (a, n) | b" • •§ax ≡ b (modn)½ökd‡ØÓ )§Ù ¥d = gcd (a, n)¶½öÃ)" Proof (Theorem 1 Inference). • éuax ≡ b (modn)ek)§Kb ∈ a S ai mod näk±Ï5§±Ï•| a | = n d Kb3ai mod n¥Ñydg" vici Number Theory
  28. ¦) ‚5•§ Theorem 2 d = gcd (a, n)§b½é êx

    Úy §kd = ax + ny "X Jd | b§Kax0 ≡ ax b d (modn) ≡ d b d (modn) ≡ b (modn)" Proof (Theorem 2). éux0 = x b d mod n§d = gcd (a, n) Kkd | b, d = ax + ny -x0 = x b d mod n ax0 ≡ ax b d mod n ≡ d b d mod n ≡ b mod n Kx0 ••§ ˜‡)" vici Number Theory
  29. ¦) ‚5•§ Theorem 3 b •§ax ≡ b (modn)k)£=kd |

    b, d = gcd (a, b)¤ §x0 ´T •§ ?¿˜‡)§KT•§é nTkd‡ØÓ )§©O•µ xi = x0 + i · n d (i = 0, 1, 2, ..., d − 1) Inference • é?¿n > 1§XJgcd (a, n) = 1§K• §ax ≡ b (modn)k•˜)" • é?¿n > 1§XJgcd (a, n) = 1§K• §ax ≡ 1 (modn)k•˜)½Ã)" Proof (Theorem 3). Ï•x0 ®²´•§ ˜‡)§dTheorem 1íا@oÙ¦)Ñ 3 a ¥§¤±ÏL\±Ï •gÏé=Œ" vici Number Theory
  30. ¦) ‚5•§ Definition e Ž{Œ±ÑÑT•§ ¤k)"Ñ\aÚn•?¿ ê§ b•?¿ ê" Algorithm

    MODULAR−LINEAR−EQUATION−SOLVER(a, b, n) (d, x , y ) = EXTENDED−EUCLID(a, n) if d | b then x0 = x · (b / d) mod n for i = 0 to d − 1 do print (x0 + i · (n / d)) mod n else print ”no solution” vici Number Theory
  31. ¥I•{½n Definition n = n1 · n2 · ... ·

    nk §Ù¥Ïfni üüpŸ"k±eéA'Xµ a ↔ (a1, a2, ..., ak) Ù¥a ∈ Zn, ai · n ∈ Zni § …éi = 1, 2, ..., kµ ai = a mod ni éZn ¥ ƒ¤‰1 $ŽŒ± d Š^uéA k |§=3 · XÚ¥Õá éz‡‹I ˜‰1¤I $Ž" XJ a ↔ (a1, a2, ..., ak) b ↔ (b1, b2, ..., bk) K        (a + b) mod n ↔ ((a1 + b1) mod n1, ..., (ak + bk) mod nk) (a − b) mod n ↔ ((a1 − b1) mod n1, ..., (ak − bk) mod nk) (a · b) mod n ↔ ((a1 · b1) mod n1, ..., (ak · bk) mod nk) vici Number Theory
  32. ¥I•{½n Methods ®•a ≡ ai (modni) , i = 0,

    1, ..., k ¦ mi = n1 · n2 · ... · ni−1 · ni+1 · ... · nk -bimi ≡ 1 (modni) ) ‚5•§§¦ bi -ci = bimi §K a ≡ a1c1 + a2c2 + ... + akck (modn1 · n2 · ... · nk) vici Number Theory
  33. ¥I•{½n Example: 8kԧؕÙê§nnꃧ• ¶ÊÊꃧ•n¶ÔÔê ƒ§• "¯ÔAÛº ) 5šfŽ²6 dKŒz•Ó{•§| 

          x ≡ 2 (mod3) x ≡ 3 (mod5) x ≡ 2 (mod7) K?˜Ú        lcm (5, 7) · k ≡ 1 (mod3) → 70 ≡ 1 (mod3) lcm (3, 7) · k ≡ 1 (mod5) → 21 ≡ 1 (mod5) lcm (3, 5) · k ≡ 1 (mod7) → 15 ≡ 1 (mod7) ¤±70 · 2 + 21 · 3 + 15 · 2 ≡ x (mod (lcm (3, 5, 7))) 233 ≡ x (mod105) x = 23 + 105k (k ∈ Z) vici Number Theory
  34. î.½nÚ¤ê½n Theorem (î.½n) éu?¿ ên > 1§aϕ(n) ≡ 1 (modn)é¤ka

    ∈ Z∗ n Ѥá" Example Ï•4 ∈ Z∗ 9 §¤±4ϕ(9) ≡ 1 (mod9) Theorem (¤ê½n) XJp´ƒê§Kap−1 ≡ 1 (modp)é¤ka ∈ Z∗ p Ѥá" • p•ƒêž§kϕ (p) = p − 1§¤±¤ê½n´î.½n AÏœ¹" vici Number Theory
  35. ‡E²•{ Definition OŽab mod n Š§Ù¥aÚb´šK ê§n´ ê" Algorithm(‡E²•{) MODULAR−EXPONENTIATION(a,

    b, n) c = 0, d = 1 let bk, bk−1, ..., b0 be the binary representation of b for i = k downto 0 do c = 2c d = (d · d) mod n if bi = 1 then c = c + 1 d = (d · a) mod n return d vici Number Theory
  36. ƒê Eratosthenesç{ Methods qÞ¤k êm = 2...n • XJm™ IP

    1. òm\\ƒêL 2. ò¤km ê£ u un¤IP • XJm® IP§Km•Üê vici Number Theory
  37. ƒê Eratosthenesç{ vici Number Theory Sieve of Eratosthenes (8 ×

    8) 9 17 25 33 41 49 57 2 10 18 26 34 42 50 58 3 11 19 27 35 43 51 59 4 12 20 28 36 44 52 60 5 13 21 29 37 45 53 61 6 14 22 30 38 46 54 62 7 15 23 31 39 47 55 63 8 16 24 32 40 48 56 64 Step 1: Numbers from 2 . . . 64
  38. ƒê ½{ Theorem (ƒê½n) lim n→∞ π(n) n/ ln n

    = 1£π (n)•ØŒux ƒê‡ê¤ Methods • ÁØ{µòTêN^ u u§ ¤kƒê Áاeþà { اKN•ƒê" • Miller-Rabin‘Å5ƒêÿÁ•{" vici Number Theory
  39. ƒê ½{ Algorithm(Miller-Rabin) WITNESS(a, n) let n − 1 =

    2tu, where t ≥ 1 and u is odd x0 = MODULAR − EXPONENTIATION(a, u, n) for i = 1 to t do xi = x2 i−1 mod n if xi = 1 and xi−1 = 1 and xi−1 = n − 1 then return true if xi−1 = 1 then return true return false vici Number Theory
  40. ƒê*¿•£ Definition (pdƒê) pdƒê´ØULy•1!i½ Ø ü‡E ê ¦È E ê"pdƒê´rƒê3EꉌS

    *Ð" Example • (1 + 2i)´pdƒê • k ê3¢ê‰ŒS´ƒê§ 3EꉌSØ´ƒê" ~X13 = (3 − 2i) · (3 + 2i) Definition (r܃ê) rÜê´•/X2n − 1 ê§P•Mn"XJ˜‡rÜê´ƒê§ @o¡§•r܃ê" Example M2 = 22 − 1 = 3§M3 = 23 − 1 = 7 vici Number Theory
  41. ë•] ({)Thomas H.Cormen, Charles E.Leiserson, Ronald L. Rivest, Clifford Stein

    5Interoduction To Algorithms6 ({)Ronald L.Graham, Donald E.Knuth, Oren Patashnik 5Concrete Mathematics6 ½˜§6 œ 5Ž{êØ6 o‘÷§o² 5p¥êÆ¿m ` §6 vici Number Theory