Modul 10 Addtonal Topcs 10.1 Lctur 1 Prambl: Dtrmnng whthr a gvn ntgr s prm or compost s known as prmalty tstng. Thr ar prmalty tsts whch mrly tll us whthr a gvn ntgr s prm or not, wthout gvng us th factors n cas th gvn numbr s compost. Thr has bn a lot of progrss n rcnt yars n prmalty tstng. In 2002, thr Indan computr scntsts found an algorthm to dtrmn whthr a gvn ntgr s prm or not. It s known as AKS algorthm, namd aftr th thr prsons nvolvd: Mandra Agarwal, Nraj Kayal and Ntn Saxna. But w ar not gong to laborat on ths algorthm. In ths lctur w wll dscuss Lucas Tst and Mllr-Rabn Tst for prmalty. Kywords: Lucas Tst, Mllr-Rabn Tst 10.1.1 Lucas Tst for Prmalty Lucas Tst s basd on Eulr s thorm whch stats that f n s any ntgr and a s coprm to n, thn a φ(n) 1modn. A spcal cas of Eulr s thorm s Frmat s Lttl Thorm, whch says that f p s a prm numbr thn a p 1 1modp 196
for any ntgr a not dvsbl by p. Lucas showd how on can us Eulr s thorm to prov prmalty. Rcall that th ordr of an ntgr a (coprm to n) modulo n s th last postv ntgr h such that a h 1modn. By dvson algorthm, on can show that h dvds any ntgr k for whch a k 1modn: k = hq + r, 0 r<h ( a k = a h) q.a r mod n 1 a r mod n r = 0 by mnmalty of h. THEOREM 10.1. Lt n b a postv ntgr and a b an ntgr coprm to n such that Thn n must b prm. a n 1 1 mod n, but a n 1 p 1mod n p (n 1). Proof: Lt n 1=p 1 1 p k k b th factorzaton of n 1 nto dstnct prm powrs. Lt h b th ordr of a modulo n. W know that h must dvd φ(n). By th hypothss, w hav h (n 1), h n 1 p p h p φ(n) (n 1) φ(n) φ(n) =n 1. Thus, n must b a prm. Exampl: Consdr n = 197. W obsrv that 197 1=2 2 7 2. Thrfor, f w can fnd an ntgr a>1coprmton such that a 196 1 mod 197, a 196 2 = a 98 1 mod 197, a 196 7 = a 28 1 mod 197, 197
n wll b prm. Now w try a = 2 and comput that 2 196 1 mod 197, 2 98 1 mod 197, 2 28 104 mod 197. Thrfor, 197 must b a prm. It s not ncssary that w nd a common bas a whch satsfs th hypothss of Lucas Tst for ach prm p dvdng n 1. W hav th followng gnralzaton: THEOREM 10.2. Lt n b a postv ntgr. Assum that for ach prm p dvdng n 1, w hav an ntgr a such that n 1 1 mod n, p but a 1mod n. a n 1 Thn n must b a prm. Proof: Lt n 1=p 1 1 p k k b th factorzaton of n 1 ntodstnctprmpowrs. Lth b th ordr of a modulo n. W know that h must dvd φ(n). By th hypothss, w hav h (n 1), h n 1 p p h p φ(n) (n 1) φ(n) φ(n) =n 1. Thus, n must b a prm. Exampl: Consdr n = 151. W obsrv that 151 1=2 3 5 2. Thrfor, f w can fnd ntgrs a 1,a 2,a 3 > 1coprmton such that a 150 1 mod 151, a 150 2 1 = a 75 1 mod 151, 2 = a 50 1 mod 151, a 150 5 3 = a 30 1 mod 151, a 150 3 198
n wll b prm. W tak a 1 =3=a 3 and a 2 = 2 and comput that 3 75 1 mod 151, 2 50 145 mod 151, 3 30 59 mod 151, 3 150 1 mod 151, 2 150 1 mod 151. Thrfor, 197 must b a prm. On drawback of Lucas tst s that t may not b too asy to fnd all th prm dvdng n 1, though n cass that w us t wll always b vn. On way to avod fndng all prm factors of (n 1) was shown by Pocklngton. H showd that t s nough to factorz n 1ntoprmpowrswhchmultplytoanntgratlast n. Whl w do not hav to factorz n 1 compltly, w wll hav to chck a strongr condton than th scond part of th hypothss n Lucas Tst. THEOREM 10.3. Lt n b a postv ntgr. Suppos w hav n 1=md, m n, and w know th prm factors p of m compltly. Assum that for ach prm p,w hav an ntgr a such that Thn n must b prm. ( a n 1 n 1 ) p 1 mod n, gcd a 1,n =1mod n p m. Proof: Consdr th prm factorzaton of n 1: n 1=p 1 1...p k k. Lt p b th smallst prm dvsor of n. Lt h b th ordr of a modulo p. Thn h must dvd p 1. Furthr, w know from th hypothss that Thn, n 1 1modp, p a a n 1 p h p (p 1). 1modp. In othr words p 1 s dvsbl by m. Thrfor, th smallst prm dvsor of n s bggr than n. Hnc, p must b n tslf, and n s a prm. 199
10.1.2 Mllr-Rabn Tst for Prmalty Mllr-Rabn tst s basd on Frmat s lttl thorm. If an ntgr fals ths tst, on can confrm that th ntgr s compost. If an ntgr passs ths tst, thr s stll a small probablty that th ntgr may b compost. It srvs as a probablstc tst for prmalty. Th followng thorm forms th bass of Mllr-Rabn Tst. THEOREM 10.4. Lt p b an odd prm. Lt p 1=2 m, gcd(2,m)=1. For any ntgr a such that 1 <a<p 1, thr a m 1 mod p, or for som j =1, 2,..., 1, a 2jm 1 mod p. Proof: Lt h b th ordr of a modulo p. W know that h dvds p 1. Hnc, Now, h =2 k m 1, m 1 m, 0 k. k =0 a m 1 1modp a m 1modp ( ) 2 k>0 a 2k 1 m 1 1modp a 2k 1 m 1 1modp or a 2k 1 m 1 1modp. But th w cannot hav th congrunc a 2k 1 m 1 1modp, as t s strctly lss than h. Th thorm follows. In ordr to apply th thorm to dcd prmalty of a gvn ntgr n, w pck a random ntgr 1 <a<n 1 and consdr th st a m,a 2m,..., a 2m = a n 1 whr n 1=2 m, 2 m. 200
In th abov st modulo n, f th occurrnc of 1 s thr at th frst plac or s prcdd by 1, w say that th ntgr n passs th Mllr-Rabn tst wth bas a. Thn th ntgr n s mor lkly to b prm, but th tst s not confrmatory. But f n fals th tst, w can mmdatly say from th abov thorm that n must b compost. In that cas, th bas a s rfrrd to as wtnss. If th ntgr n passs th Mllr-Rabn tst wth bas a, w can try anothr bas to b a. Ifwpckk ntgrs a 1,a 2,..., a k randomly and prform th Mllr-Rabn tst, th probablty that an ntgr whch passs th tst s stll compost turns out to b ( 1 k. 4) Hnc, thr s a vry small chanc that a compost numbr passs th Mllr-Rabn tst. For xampl, f w prform th tst wth 20 bass thn th ntgr passng th tst s prm wth th probablty 1 ( 1 20, 4) whch s vry clos to 1. Exampl: Lt us dmonstrat th mthod wth n = 341, whch s a Eulr psudo-prm. Obsrv that 341 1=2 2 5 17 = 2 2 85. Lt us tak a = 2, and comput 2 10 = 1024 = 341 3+1 1 mod 341 2 85 2 5 1 mod 341, 2 170 1 mod 341. Snc th occurrnc of 1 s not prcdd by 1 n th abov, w can conclud that 341 fals th Mllr-Rabn tst for prmalty. Thrfor, 341 must b compost and 2 s a wtnss. 201