Programming Team Independent Study Homework Week #4: Number Theory Solutions 1) What is the largest positive integer n for which n3 + 100 is divisible by n+10? (Hint: Use division of polynomials.) Solution By examining the denominator, we see that n = 890 is the largest value that keeps the expression integral. (Note that anything bigger creates a fraction strictly in between 0 and 1, subtracted from an integer.) 2) A positive integer is written on each face of a cube. Each vertex is then assigned a product of the numbers written on the three faces intersecting the vertex. The sum of the numbers assigned to all the vertices is equal to 1001. Find the sum of the numbers written on the faces of the cube. Solution Let the integers written on each face be a,b,c,d,e, and f. Now, set up an equation with the given information. (Treat a as the top of the cube and f as the bottom.) abc + acd + ade + aeb + fbc + fcd + fde + deb = 1001 a(bc + cd + de + eb) + f(bc + cd + de + eb) = 1001 (a + f)(bc + cd + de + eb) = 1001 (a + f)(c(b+d) + e(b+d)) = 1001 (a + f)(c + e)(b + d) = 1001 = 7 x 11 x 13 Since each of a, b, c , d , e, and f are positive, it follows that each of the three terms in the product is 2 or greater. Since 7, 11 and 13 are all prime, it follows that one of the terms must be 7, another 11 and the last 13. The desired sum is 7 + 11 + 13 = 31. 3) Find all positive integers n for which n!+5 is a perfect cube. Solution By inspection, we find n = 5 is a solution since 5! + 5 = 125 = 53. Now, we must try to prove that there are no more solutions. Clearly, for all n > 5, n! + 5 is divisible by 5. Thus, if it is to be a perfect cube, it must be divisible by 53. Our goal will be to prove that for all n > 5, n! + 5 is NOT divisible by 53. First, let’s show there are no solutions for n > 9. Note that 25 | 10!, because both 5 and 10 are separate factors of 10!. Consider the expression (n! +5) mod 25, for any n > 9. (n! + 5) ≡ 5 mod 25 → 125 | (n! + 5) is false. From here, we can check n = 6,7,8 and 9 by hand and verify that none of these make the expression a perfect cube. 4) Find the number of ordered triples (a,b,c) of positive integers for which lcm(a,b)=1000, lcm(b,c)=2000, and lcm(c,a) = 2000. Solution Let a, b and c be prime factorized as a = 2a15a2 , b = 2b15b2 and c = 2c15c2 where a1, a2, b1, b2, c1 and c2 are non-negative integers. Using the given information we have: max(a1, b1) = 3 max(b1, c1) = 4 max(c1, a1) = 4 max(a2, b2) = 3 max(b2, c2) = 3 max(c2, a2) = 3 (These values come from prime factorizing 1000 and 2000 and setting equal the appropriate exponents in the prime factorizations.) Note that a1 can’t be 4. This means c1 must be. Thus, b1 can be 0, 1, 2 or 3. When b1 is 0, 1 or 2, a1 must be 3. (This is 3 solutions.) If b1 is 3, a1 can be 0, 1, 2 or 3. (This is 4 solutions. So far, we have a total of 7 solutions for a1, b1 and c1. Now, let’s deal with a2, b2 and c2. Any 2 of these can be 3. So have a2=b2=3, c2=0,1,2. Or have a2=c2=3 and b2=0,1,2. Or have b2=c2=3 and a2=0,1,2, or 3. There are 10 solutions here. Any solution set for (a1,a2,a3) can be paired with any solution set for (b1,b2,b3) for a total of 70 solutions. 5) Let p be prime and let 1 ≤ k ≤ p-1 be an integer. Prove that Solution Let . Our goal will be to find X. Multiply this equation through by k!(p – 1 – k)! to yield: , using Wilson’s Theorem , noting that -1(p-i) ≡ i mod p. , using Wilson’s Theorem again. , multiplying through by -1 , multiplying through by (-1)k and noting that (-1)2k = 1. 6) Show that if p is prime, then Solution Let . Now multiply this equation through by (p-1)! to yield: . , using Wilson’s Theorem , dividing by (p-1)! , dividing by p! , dividing by p , reducing terms mod p. , using Wilson’s Theorem , multiplying through by -1. 7) What is the remainder when 40! is divided by 1763? Solution Wilson’s Theorem says 40! ≡ 40 mod 41. Note that 4763 = 41 x 43. Now, we want to calculate 40! mod 43. Note that 43 is prime also, so we know that 42! = 42 mod 43. 42! ≡ (40!)(-2)(-1) ≡ 42 (mod 43) 2(40!) ≡ 42 (mod 43), we know that 2-1 ≡ 22 (mod 43). So, multiply this through by 22: 22(2)(40!) ≡ 22(-1) (mod 43) 40! ≡ -22 (mod 43) 40! ≡ 21 (mod 43) So, now we have two equations: 40! ≡ -1 (mod 41) 40! ≡ 21 (mod 43) Use the Chinese Remainder Theorem to solve for 40! mod 1763. Let x = 40! So, we have: x ≡ -1 (mod 41) x ≡ 21 (mod 43) 43x ≡ -43 (mod 1763) 41x ≡ 861 (mod 1763) Since 43 ≡ 2 mod 41, we have 43-1≡ 21 mod 41. Since 41≡ -2 mod 43, we have 41-1 ≡ 21 mod 43. Multiply both equations through by 21: 903x ≡ -903 (mod 1763) 861x ≡ 18081 (mod 1763) ---------------------------------1764x ≡ 17178 (mod 1763) x ≡ 1311 (mod 1763) Thus, this is our desired remainder. The sad thing is that it took me 15 minutes to write out this solution and about 45 seconds to verify this answer by writing some code! 8) What is the remainder when 62000 is divided by 11? Solution Using Fermat’s theorem, we know that 610 ≡ 1 mod 11. It follows that 62000 ≡ (610)200 ≡ 1200 ≡ 1 mod 11. 9) What is the remainder when 3100000 is divided by 35? Solution Using Euler’s Theorem, we have that φ(35) = 4 x 6 = 24, so 324 ≡ 1 mod 35. 3100000 ≡ (324)4166316 mod 35 ≡ 14166(34)4 mod 35 ≡ 814 mod 35 ≡ 114 mod 35 ≡ 1212 mod 35 ≡ 162 mod 35 ≡ 256 mod 35 ≡ 11 Or, an easier solution would have been to note that 312 ≡ 1 mod 35 and go from there! 10) Show that , if a and b are relatively prime positive integers. (Hint: Consider the expression on the left mod a and mod b, separately.) Solution Consider the equation mod a: , by Euler’s Theorem, since gcd(a,b)=1. , by Euler’s Theorem, since gcd(a,b) =1. Now, using the CRT, we can solve this system of equations mod ab. Clearly, the unique solution is 1 mod ab. (One of the few easy cases of the CRT!) 11) Let f(n) = . Write a program to investigate the ratio f(n)/n2 as n increases. (For example, compute this ratio for n=100,1000 and 10000.) Can you make a conjecture about this ratio as n grows to infinity? Solution I have no idea, really. It looks like the value usually hovers between 1/n and 1/2n, which is to be expected because for most integers n, n > phi(n) > n/2.