Linear Congruences and The Chinese Remainder Theorem
This is Lab 6 from Clint by Hugh Montgomery, edited by Elad Zelingher. All rights reserved to Hugh Montgomery.
Problem 1
The program LinCon applies the extended Euclidean algorithm to find the complete solution set of the linear congruence .
You now have two methods for finding solutions of linear congruences. You can use either (i) LinCon or (ii) PolySolv. Try both methods on the congruence (mod 10000001). Which method takes longer to run? Estimate the running time for the two methods as a function of . Which method is asymptotically faster?
Problem 2
Let and be given, and put . The intersection of an arithmetic progression with an arithmetic progression is an arithmetic progression if , and is otherwise empty (Recall Problem 20 at the end of of NZM.). The program IntAPTab presents these intersections in a manner reminiscent of the table on p. 68 of NZM. Rows are indexed by residues , and columns by . Run IntAPTab with parameters . Note that in the body of the table, each of the numbers occurs exactly once. That is, the simultaneous congruences are equivalent to the single congruence , for some suitable value of . The more general assertion that this is true whenever is known as the Chinese Remainder Theorem (Theorem 2.18 of NZM). Take in IntAPTab, and take a stroll around the table. There are now so many entries that it is no easy to see, by inspection, that each number occurs exactly once in the body of the table. Now take , in IntAPTab. What proportion of the entries are blank? Why? This phenomenon becomes more pronounced when is large. Try taking .
Problem 3
The program CRT (meaning "Chinese Remainder Theorem") determines the intersection of two given arithmetic progressions. For example, the numbers such that both and are precisely the numbers for which . Run CRT with suitable parameters and watch the results. On the other hand, there are no for which both and . To see why this is so, run CRT with suitable parameters.
Problem 4
By repeated use of CRT, find a number such that and none of , , , is squarefree. Thus we have a gap of length at least 8 between consecutive squarefree numbers. (Hint: What if , , , , , , .) Apply the program Factor to each of the numbers , , , to verify your results. Are and both squarefree?
Problem 5
Take in IntAPTab. Note that an entry in the body of the table is printed in White if and only both the column and row labels of that entry are printed in White. More generally, if , and , then if and only if and . Hence the number of reduced residues is the number of reduced residues times the number of reduced residues . That is, whenever . Since it is easy to see that , we deduce that
Thus we can calculate easily, once the factorization of has been determined. The program Phi proceeds in this way: First the argument is factored, and then the above formula is used. Try using Phi for the input 42. You can confirm this answer by taking in CngArTab, and viewing the multiplication table with only the reduced residues displayed.
Problem 6
By using PolySolv, find two distinct residue classes and modulo 31 so that . Similarly, find three distinct residue classes modulo 47 so that . By using CRT, find six residue classes modulo so that and . Apply PolySolv with . Interpret your findings. Note the conformity of this with Theorem 2.20 in NZM.
Problem 7
Recall that the only solutions of are (See Lemma 2.10 of NZM.). Given that , use the program CRT to find four roots of the congruence . Verify your results by using PolySolv. When is composite you now have two methods for locating all the roots of a polynomial congruence . You can (i) apply PolySolv directly to the modulus , or (ii) factor into primepowers, apply PolySolv to each of these primepowers, and then use CRT to combine these solutions to construct the solutions modulo m. Estimate the running time of these two approaches. Which one is faster for a typical large composite number?