Number Theory Worksheet 3 – Modular Arithmetic 1. If 𝑛 can be any natural number: a. What are the possible remainders when 𝑛4 is divided by 3? b. For what powers of 𝑛 do we obtain the same residues as in (a)? 2. Suppose that 𝑛3 was expressed in the form 7𝑎 + 𝑏, for positive integers 𝑎, 𝑏, 𝑛. For which 𝑏 is this possible? 3. Determine the arithmetic sequence of the following number of primes, such that the last term in the sequence is the smallest possible value: (for example, for 3 primes, the arithmetic sequence would be 3, 5, 7, and for 4 primes, the arithmetic sequence would be 5, 11, 17, 23) a. 5 primes. b. 6 primes. 4. [Source: Based on a UKMT Mentoring question] Suppose that 1! + 2! + 3! + ⋯ + 𝑝! = 𝑞 2 where 𝑝 and 𝑞 are integers. By considering possible residues for the RHS modulo-10 and similarly the residues on the LHS modulo-10 as 𝑝 increases, find all integer solutions. 5. Give the form of all numbers which leave a remainder of 1 when divided by any of 2, 3 or 5. 6. [Source: UKMT Mentoring] Find all values for which 𝑝2 + 14 is prime, where 𝑝 is prime (Hint: as per the lecture slides, consider different moduli). 7. Give the form of all integers 𝑛 such that 2𝑛 − 𝑛2 is divisible by 7. (Hint: consider the residues of 2𝑛 and 𝑛2 as 𝑛 increases) www.drfrostmaths.com/rzc Number Theory Worksheet 3 – Modular Arithmetic - ANSWERS 1. If 𝒏 can be any natural number: (a) What are the possible remainders when 𝒏𝟒 is divided by 3? (b) For what powers of 𝒏 do we obtain the same residues? If 𝑛 ≡ 0, 1, 2 (𝑚𝑜𝑑 3) then 𝑛4 ≡ 0, 1, 1 (𝑚𝑜𝑑 3). We’ll obtain the same residues for any even power, because if 𝑛2 ≡ 0, 1, 1 (𝑚𝑜𝑑 3) then be laws of modular arithmetic, (𝑛2 )𝑘 = 0𝑘 , 1𝑘 , 1𝑘 = 0, 1, 1 (𝑚𝑜𝑑 3), and 𝑛2𝑘 represents any even power of 𝑛. 2. Suppose that 𝒏𝟑 was expressed in the form 𝟕𝒂 + 𝒃, for positive integers 𝒂, 𝒃, 𝒄. For which 𝒃 is this possible? The possible remainders of 𝑛3 modulo-7 are 0, 1, 1, 6, 1, 6, 6. And the remainder of 7𝑎 + 𝑏 in modulo-7 is obviously 𝑏. Thus we require that 𝑏 = 2, 3, 4, 5. 3. Determine the arithmetic sequence of the following number of primes, such that the last term in the sequence is the smallest possible value: (for example, for 3 primes, the arithmetic sequence would be 3, 5, 7, and for 4 primes, the arithmetic sequence would be 5, 11, 17, 23) a. 5 primes. Using the principles from the slides, our difference has to be divisible by 2 otherwise we’d have an even number (not prime!) every other number, and we’d have a number divisible by 3 every third number if the difference wasn’t divisible by 3 (recall that we see all possible residues modulo-3 each 3 numbers if the difference is coprime to 3, and since 3 is prime, it will be coprime with any number that is not a multiple of itself). If the first number was 5 (which is prime), then we wouldn’t need the difference to be divisible by 5 because the next number divisible by 5 wouldn’t be until 5 numbers later in the sequence (i.e. beyond the end of the list). So the difference has to be divisible by at least 2 × 3 = 6 if the first number is 5, and be divisible by 2 × 3 × 5 = 30 if the first number isn’t 5. And indeed this works: 5, 11, 17, 23, 29. b. 6 primes. By the same reasoning as above, the difference must be divisible by 2, 3 and 5, and thus divisible by 30. The first term then can’t be 2, 3 or 5. But making the first term 7 and the difference 30 works: 7, 37, 67, 97, 127, 157. 4. Suppose that 𝟏! + 𝟐! + 𝟑! + ⋯ + 𝒑! = 𝒒𝟐 where 𝒑 and 𝒒 are integers. By considering possible residues for the RHS modulo-10 and similarly the residues on the LHS modulo-10 as 𝒑 increases, find all integer solutions. 𝑝! is divisible by 10 when 𝑝 ≥ 5, i.e. 1! + 2! + 3! + 4! + 5! + ⋯ + 𝑝! = 1 + 2 + 6 + 4 + 0 + 0 + 0 + ⋯ ≡ 3 (𝑚𝑜𝑑 10). The possible residues of square number modulo-10 are 1, 4, 9, 6, 5, 6, 9, 4, 1, 0. Since the residue can’t be 3, the equation has no solutions when 𝑝 ≥ 4. All that remains is to check www.drfrostmaths.com/rzc 𝑝 = 1, 2, 3: 1! = 1 (which is a square, so 𝑝 = 𝑞 = 1 is a solution) 1! + 2! = 3 (which is not square) 1! + 2! + 3! = 9 (which is square, so 𝑝 = 𝑞 = 3 is a solution) 5. Give the form of all numbers which leave a remainder of 1 when divided by any of 2, 3 or 5. Since 2, 3 and 5, the lowest common multiple of these numbers is 2 × 3 × 5 = 30. Clearly a number is divisible by 2, 3 and 5 if and only if it is a multiple of 30. Thus a number of the form 30𝑘 + 1 where 𝑘 ≥ 0 will give a remainder of 1. 6. Find all values for which 𝒑𝟐 + 𝟏𝟒 is prime, where 𝒑 is prime (Hint: as per the lecture slides, consider different moduli). In modulo-3, the possible residues of 𝑝 are 0, 1 and 2. But we can exclude the 0 case because otherwise 𝑝 would be divisible by 3 and thus not prime. The possible residues of 𝑝2 are 1, 1, and thus 0, 0 once we add the 14. These are both divisible by 3. Thus there are no values for which 𝑝2 + 14 is prime. 7. Give the form of all integers 𝒏 such that 𝟐𝒏 − 𝒏𝟐 is divisible by 7. Let’s work in modulo 7, so that we require 2𝑛 − 𝑛2 ≡ 0 (𝑚𝑜𝑑 7). Trying the first few values of 𝑛 gives us 2, 4, 1, 2, 4, 1, where we can clearly see with have a cycle every 3 digits (the reason is because if 23 ≡ 1(𝑚𝑜𝑑 7), then 23𝑘 ≡ 1𝑘 ≡ 1 (𝑚𝑜𝑑 7), so that the remainder is 1 whenever the power is multiple of 3). As we similarly consider 𝑛2 , we get the residues, 1, 4, 2, 2, 4, 1, 0 as 𝑛 increases. Since one cycles every 3 values and the other every 7 values, the two combined cycle every 21 (i.e. the Lowest Common Multiple of 3 and 7). Writing out these residues, we find that we get a remainder of 0 overall when 𝑛 ≡ 2, 4, 5, 6, 10, 15 (𝑚𝑜𝑑 21). Thus the form of 𝑛 is 21𝑘 + 2, 21𝑘 + 4, etc. www.drfrostmaths.com/rzc