MATH 313: SOLUTIONS HW2 Problem 1 (a) 30941 We use the Miller-Rabin test to check if it prime. We know that the smallest number which is a strong pseudoprime both base 2 and base 3 is 1373653; hence, if 30941 passes the test for both base 2 and base 3 it will have to be prime since 30941 < 1373653. Base 2: 30490 = 22 × 7735. 27735 ≡ 5826 (mod 30941). 215490 ≡ −1 (mod 30941) ⇒ pass the test. Base 3: 37735 ≡ 5826 (mod 30941). 215490 ≡ −1 (mod 30941) ⇒ pass the test. Therefore 30941 is prime and we are done! (b) 33918 Use Miller-Rabin test to check primality. Base 2: 33918 = 2 × 16959. 216959 ≡ 8186 (mod 33919). 233918 ≡ 20571 (mod 33919). Fail the test! so 33919 is composite. After checking the legendre symbols, we should find the following factor base: {2, 3, 5, 7, 17, 19, 31, 37, 43, 47, 53}. Also note that √ 33919 = 184 and we find that sieving between 170 and 203 is sufficient. I omit the table with the computation of x and Q(x). I will just use a combination which works for factoring: Q(173)Q(177)Q(188)Q(193)Q(203) = (−2 × 3 × 5 × 7 × 19)(−2 × 5 × 7 × 37)(3 × 52 × 19)(2 × 32 × 5 × 37)(2 × 36 × 5) = 24 × 310 × 56 × 192 × 372 . We can now look at the gcd to check if we get non-trivial factors: gcd((173 × 177 × 188 × 193 × 203) − (22 × 35 × 53 × 19 × 37), 33919) = 317 gcd((173 × 177 × 188 × 193 × 203) + (22 × 35 × 53 × 19 × 37), 33919) = 107 Hence, 33919 = 107 × 317. (c) 68569 Use Miller-Rabin test to check primality. Base 2: 68568 = 23 × 8571. 28571 ≡ 14870 (mod 68569). 217142 ≡ 50444 (mod 68569). 234284 ≡ 1546 (mod 68569). 268568 ≡ 58770 (mod 68569). Fail the test! so 68569 is composite. After checking the legendre symbols, we should find the following factor base: {2, 3, 5, 7, 17, 19, 23, 29, 31, 53, 61}. √ Also note that 68569 = 262 and we find that sieving between 242 and 282 is sufficient. I omit the table with the computation of x and Q(x). I will just use a combination which works for factoring: Q(262)Q(263)Q(264)Q(265) = (3 × 52 )(23 × 3 × 5)(72 × 23)(23 × 32 × 23) = 26 × 34 × 54 × 72 × 232 . We can now look at the gcd to check if we get non-trivial factors: gcd((262 × 263 × 264 × 265) − (23 × 32 × 52 × 7 × 23), 68569) = 191 gcd((262 × 263 × 264 × 265) − (23 × 32 × 52 × 7 × 23), 68569) = 359 Hence, 68569 = 191 × 359. (d) 838861 Use Miller-Rabin test to check primality. Base 2: 838860 = 23 × 8571. 2209715 ≡ 2048 (mod 838861). 2419430 ≡ −1 (mod 838861). Pass the test! so 838861 can be a prime. Base 3: 3209715 ≡ 456516 (mod 838861). 2419430 ≡ 231416 (mod 838861). 2838860 ≡ 478816 (mod 838861). Fail the test! so 838861 is a composite. After checking the legendre symbols, we should find the following factor base: {2, 3, 5, 7, 11, 13, 17, 19, 29, 31, 37}. Also note that √ 838861 = 916 and we find that sieving between 896 and 936 is sufficient. I omit the table with the computation of x and Q(x). I will just use a combination which works for factoring: Q(917)Q(923) = (22 × 3 × 132 )(22 × 33 × 112 ) = 24 × 34 × 112 × 132 . We can now look at the gcd to check if we get non-trivial factors: gcd((917 × 923) − (22 × 32 × 11 × 13), 838861) = 397 gcd((917 × 923) + (22 × 32 × 11 × 13), 838861) = 2113 Hence, 838861 = 371 × 2113. (e) 1016801 Use Miller-Rabin test to check primality. Base 2: 1016800 = 25 × 31775. 231775 ≡ −1 (mod 1016801). Pass the test! so 1016800 can be a prime. Base 3: 3209715 ≡ 509141 (mod 1016801). 363550 ≡ 294140 (mod 1016801). 3127100 ≡ 776112 (mod 1016801). 3254200 ≡ 991348 (mod 1016801). 3508400 ≡ 152972 (mod 1016801). 31016800 ≡ 791371 (mod 1016801). Fail the test! so 1016800 is a composite. After checking the legendre symbols, we should find the following factor base: {2, 5, 7, 11, 19, 29, 31, 37, 41, 3, 47, 53}. Also note that √ 1016801 = 1008 and we find that sieving between 978 and 1038 is sufficient. I omit the table with the computation of x and Q(x). I will just use a combination which works for factoring: Q(991)Q(999)Q(1011)Q(1022) = (−25 × 5 × 7 × 31)(−24 × 52 × 47)(23 × 5 × 7 × 19)(19 × 31 × 47) = 212 × 54 × 72 × 192 × 312 × 472 . We can now look at the gcd to check if we get non-trivial factors: gcd((991 × 999 × 1011 × 1022) − (26 × 52 × 7 × 19 × 31 × 47), 1016801) = 4051 gcd((991 × 999 × 1011 × 1022) + (26 × 52 × 7 × 19 × 31 × 47), 1016801) = 251 Hence, 1016801 = 4051 × 251. (f) 1149847 Use Miller-Rabin test to check primality. Base 2: 1149846 = 2 × 574923. 2574923 ≡ 923023 (mod 1149847). 21149846 ≡ 372808 (mod 1149847). Fail the test! so 1149847 is a composite. After checking the legendre symbols, we should find the following factor base: {2, 3, 13, 17, 19, 23, 41, 61, 67, 71, 73}. Also note that √ 1149847 = 1072 and we find that sieving between 1012 and 1131 is sufficient. I omit the table with the computation of x and Q(x). I will just use a combination which works for factoring: Q(1077)Q(1085) = (2 × 712 )(2 × 34 × 132 ) = 22 × 34 × 132 × 712 . We can now look at the gcd to check if we get non-trivial factors: gcd((1077 × 1085) − (2 × 32 × 13 × 71), 1149847) = 521 gcd((1077 × 1085) + (2 × 32 × 13 × 71), 1149847) = 2207 Hence, 1149847 = 521 × 2207. Problem 2 Here are 6 possible factors: (1) Q(103) × Q(107) = 210 × 72 . 2 potential factors: gcd(103 × 107 + 210 × 72 , 10553) gcd(103 × 107 − 210 × 72 , 10553) (2) Q(103) × Q(110) × Q(111) = 26 × 72 × 132 × 172 . 2 potential factors: gcd(103 × 110 × 111 + 26 × 72 × 132 × 172 , 10553) gcd(103 × 110 × 111 − 26 × 72 × 132 × 172 , 10553) (3) Q(107) × Q(110) × Q(111) = 210 × 72 × 132 × 172 . 2 potential factors: gcd(107 × 110 × 111 + 210 × 72 × 132 × 172 , 10553) gcd(107 × 110 × 111 − 210 × 72 × 132 × 172 , 10553) Problem 3 Note that the form p2k − 2047qk2 = ±Qk−1 ⇔ p2k ≡ ±Qk−1 (mod 2047). In order to use the quadratic sieve, we want the product of some (±Qk−1 ) to be a perfect square. Observe that in the Qk+1 given, we already have a perfect square when pk = 181 and Qk+1 = 32 . Therefore, we can use this one to try to factorize 2047. Following the observation above, we have: 1812 ≡ 32 (mod 2047). Now, we find that gcd(181 + 3, 2047) = 23 and 2047/23 = 89. Hence, we get 2047 = 23 × 89. The period is at least 5. Problem 4 Let’s look at the first few convergents of √ 154421. Note: You were supposed to compute the convergents using the algorithm used in class. I will omit this step in the solution, but you should be able to obtain the same 6 first convergents by going through the algorithm. [Steps of the algorithm: (1) compute αi ’s and ai ’s, (2) find pi ’s and qi ’s. You now have the convergents and are able to compute Qi ’s.] First convergent: 392 ⇒ 3922 − 154421 × 12 = −757. Not a perfect square. Second convergent: 393 ⇒ 3932 − 154421 × 12 = 28 = 22 × 7. Not a perfect square and cannot get a perfect square with a product of previous convergents. Third convergent: 11003/28 ⇒ 110032 − 154421 × 282 = −55 = 5 × 11. Not a perfect square and cannot get a perfect square with a product of previous convergents. Fourth convergent: 154435/393 ⇒ 1544352 − 154421 × 3932 = 196 = 22 × 72 = 142 . Perfect square. We can compute the gcd to find out if it gives us a factorization: gdc(154435 + 14, 154421) = 1 and gdc(154435 − 14, 154421) = 154421. So it doesn’t give us a factorization! We continue looking at convergents... Fifth convergent: 474308/1207 ⇒ 4743082 − 154421 × 12072 = −565 = −5 × 113. Not a perfect square and cannot get a perfect square with a product of previous convergents. Sixth convergent: 628743/1600 ⇒ 6287432 − 154421 × 16002 = 49 = 72 . Perfect square. We can compute the gcd to find out if it gives us a factorization: gdc(628743 + 7, 154421) = 503 and 154421/503 = 307. Hence we get 154421 = 307 × 503.