DIVISIBILITY TEST FOR PRIME FACTORS OF SUCCESSORS AND
DIVISIBILITY TEST FOR PRIME FACTORS OF SUCCESSORS AND PREDECESSORS OF POWERS OF TEN USING MATRICES by R. KEERTHAN AND V. K. NARASIMHAN
CONTENTS: q PREDECESSORS OF POWERS OF TEN § Illustrations 1& 2 § General Algorithm § Divisibility test for a prime P|(10 n -1) § Fermat’s little theorem q SUCCESSORS OF POWERS OF TEN § Illustrations 1& 2 § General Algorithm § Divisibility test for a prime P|(10 n+1)
PREDECESSORS OF POWERS OF TEN Consider a prime “p” which divides 10 n – 1 We can devise a method for test of divisibility of “p” By generating a code matrix for “p” as follows. ILLUSTRATION 1: Consider the prime 37. 37|(103 -1) 100 1 mod 37 101 10 mod 37 102 -11 mod 37 103 1 mod 37 [since 37|(103 -1)] 104 10 mod 37 [104 =103. 101 1(10) mod 37] 105 -11 mod 37 106 1 mod 37 , and so on
Consider the number 27345189 = 2. 10 7 + 7. 106 + 3. 105 + 4. 104 + 3. 103+ 1. 102 + 8. 10 + 9 2. 10 + 7. 1 + 3. (-11) + 4. 10 + 5. 1+1. (-11) + 8. 10+9. 1 mod 37 10(2+4+8) + 1(7+5+9) +(-11)(3+1) mod 37 Now, let us try to represent this using matrices : Define to be the code matrix C
Now, starting from the right, divide the given number into blocks of 3 (the length of the code matrix). 027|345|189 Fill the empty spaces on the left side of the last block with zeroes. Let S be the sum matrix, which is the sum of the block matrices [ 0 2 7] , [3 4 5] and [1 8 9 ] S = [ 0+3+1 2+4+8 7+5+9 ] 27345189 . [ 0+3+1 2+4+8 7+5+9] mod 37
27345189 If C. S mod 37. 0 mod 37 , then 27345189 is divisible by 37. Otherwise, 27345189 leaves the same remainder as C. S when divided by 37. NOTE: In case C. S itself is a huge number, we can use the same method to determine whether it is divisible by 37.
ILLUSTRATION 2 : Consider the prime 101 divides 104 – 1 100 1 mod 101 102 -1 mod 101 103 -10 mod 101 104 1 mod 101 [since 101|(104 -1] 105 10 mod 101 [105 =104. 101 106 -1 mod 101 107 -10 mod 101 108 1 mod 101 1(10) mod 101]
Consider the number 4561327753412 = 4. 1012 +5. 1011+ 6. 1010 + 1. 109 + 3. 108 + 2. 107 + 7. 106 + 7. 105 + 5. 104 + 3. 103 + 4. 102 + 1. 10 + 2 4. 1 + 5. (-10) + 6. (-1) + 1. 10 + 3. 1 + 2. (-10) + 7. (-1) + 7. 10 + 5. 1 + 3. (-10) + 4. (-1) +1. 10 + 2. 1 mod 101 1( 4+3+5+2) + (-10)(5+2+3) + (-1)(6+7+4) + 10(1+7+1) mod 101 Now let us try to represent this using matrices.
Define as the code matrix C. Now, starting from the right , divide the number into blocks of four ( the length of the code matrix). 0004| 5613| 2775|3412| Let S be the sum matrix, which is the sum of the blocks. [0 0 0 4] , [5 6 1 3] , [2 7 7 5] and [3 4 1 2].
S = [ 0+5+2+3 0+6+7+4 0+1+7+1 4+3+7+2 ] 4561327753412 [0+5+2+3 0+6+7+4 0+1+7+1 4+3+7+2] mod 101 C. S mod 101 If C. S is divisible by 101, then 4561327753412 is divisible by 101. Otherwise it leaves the same remainder that C. S leaves on division by 101.
GENERAL ALGORITHM FOR GENERATING A CODE MATRIX OF A PRIME p , WHICH DIVIDES 10 n -1 If “p” divides 10 n – 1, 10 n 1 mod p 100 1 mod p Let 101 c 1 mod p 102 c 2 mod p 10 n– 1 cn-1 mod p 10 n 1 mod p [since p|10 n-1] 10 n+1 c 1 mod p [10 n+1=10 n. 10 1(c 1) mod p]
Here , the code matrix C is The length of the code matrix is n. Let N = ak-1 ak-2 a 0 be a K digit number. This number can be written as n. q + r by Euclid’s division lemma. N can be divided into q blocks of length n if r = o and q+1 blocks of length n with (n-r) spaces in the (q+1)th block if r 0. Now , consider every block and define S , as the sum matrix of all the blocks. N S. C mod p. i. e - N leaves the same remainder as S. C, when divided by p.
Divisibility test for 3 We observe that, 100 1 mod 3 101 1 mod 3 102 1 mod 3 Therefore, the code matrix for 3 is [1]. Now, consider a k-digit number, N=ak-1 ak-2…a 2 a 1 a 0 It can be divided into k blocks of 1 digit each. The sum matrix is [ak-1 ak-2 … a 2 a 1 a 0] According to the Algorithm for testing divisibility, N [1]. [ak-1 ak-2 … a 2 a 1 a 0] mod 3
i. e- N ak-1+ak-2+…+a 2+a 1+a 0 mod 3 Therefore, any number is divisible by 3 if the sum of its digits is divisible by 3 For example, Consider 9389625 The sum of its digits is 9+3+8+9+6+2+5=42 which is divisible by 3, 9389625 is divisible by 3. NOTE : In case the sum of the digits itself is a huge number, we can the use the same method again to determine whether it is divisible by 3.
Fermat’s little theorem states that, if (a, p)=1, Then ap-1 1 mod p a, p Now, Let a =10 and p be any prime other than 2 & 5 (a, p)=1. Therefore, Fermat’s little theorem will hold good. We will always be able to find a natural no. n such that, 10 n 1 mod p, for all primes other than 2 & 5. Therefore, the above mentioned algorithmic test of divisibility will hold good for all primes other than 2 & 5. Thus, we have found a generic test of divisibility for all primes other than 2 & 5.
SUCCESSORS OF POWERS OF TEN Consider a prime “p” that divides 10 n +1. We can devise a method for test of divisibility for “p” by generating a code matrix for “p” as follows. ILLUSTRATION 1: Consider the prime 7. 7|1001(103 +1) 100 1 mod 7 101 3 mod 7 102 2 mod 7 103 -1 mod 7 [since 7|103+1] 104 -3 mod 7 [104=103. 101 -1(3) mod 7] 105 -2 mod 7 106 1 mod 7 , and so on.
Consider a number , say 53497862. = 5. 107+3. 106+4. 105+9. 104+7. 103+8. 102+6. 101+2 5(3)+3(1) +4(-2) +9(-3)+7(-1) +8(2) + 6(3)+2(1) mod 7. 2(0 - 4+8) +3(5 - 9+6) 1(3 - 7+2) mod 7 Let us try to represent this using matrices. Define as the code matrix C. Now, starting from the right , divide the given number into blocks of three. 053|497|862. Fill empty spaces in the last block with zeroes. Let O be the sum of odd placed matrices and E be the sum of even placed matrices starting from the right. O =[0 5 3] + [8 6 2] E =[4 9 7].
Let D = O - E be the difference matrix. D = [0 - 4+8 5 -9+6 3 - 7+2] 53497862 C. D mod 7 53497862 leaves the same remainder as C. D when divided by 7.
ILLUSTRATION 2: Consider the prime 13. 13 divides 1001(103 +1) 100 1 mod 13 101 -3 mod 13 102 -4 mod 13 103 -1 mod 13 [since 13|103+1] 104 3 mod 13 [104=103. 101 -1(-3) mod 13] 105 4 mod 13 106 1 mod 13 [106 =(103)2 (-1)2 mod 13]
Consider a number, say 35467821 = 3. 107+5. 106+4. 105+6. 104+7. 103+8. 102+2. 10+1 3(-3) + 5(1) +4(4) +6(3) + 7(-1) +8(-4)+2(-3)+1(1) mod 13 Let us try to represent this using matrices. Define as the code matrix C. Now, divide the given number into blocks of three, starting from the right. 035|467|821 Fill the empty spaces in the last block with zeroes. Let O be the sum of odd placed matrices and E be the sum of even placed matrices, starting from the right. O = [0 3 5] + [8 2 1] E =[4 6 7]
Let D = O - E be the difference matrix. D = [ 0 - 4+8 3 - 6+2 5 - 7+1] 35467821 D. C mod 13 35467821 leaves the same remainder as D. C on division by 13.
General algorithm for generating code matrix of a prime p that divides 10 n+1 If a prime p divides 10 n + 1 , 10 n 100 Let 101 102 10 n-1 -1 mod p c 2 mod p cn-1 mod p 10 n -1 mod p [since p|10 n+1] 10 n+1 -c 1 mod p [10 n+1=10 n. 10 102 n-1 102 n -1(c 1) mod p] -cn-1 mod p , and so on
The code matrix C here is Length of the code matrix is n. Let N = ak-1 ak-2 a 0 be a K digit number. This number can be written as n. q + r by Euclid’s division lemma. N can be divided into q blocks of length n if r=o and q+1 blocks of length n with (n-r) spaces in the (q+1)th block if r 0 Let O be the sum of odd placed matrices and E be the sum of even placed matrices, starting from the right. Define D = O – E as the difference matrix. N C. D mod p. If C. D is divisible by p, then N is divisible by p. Otherwise, It is not
Divisibility test for 11 We observe that, 100 1 mod 11 101 -1 mod 11 102 1 mod 11 103 -1 mod 11 104 1 mod 11 Therefore, the code matrix for 11 is Now, consider a k-digit no. , N=ak-1 ak-2…a 2 a 1 a 0 It can be divided into blocks of two as shown. ak-1 ak-2|…|a 3 a 2|a 1 a 0 0 ak-1|ak-2 ak-3|…|a 1 a 0 if k is even, and if k is odd.
According to the algorithm for testing divisibility, N . [sum of even-placed digits sum of odd-placed digits] Therefore, any number is divisible by 11 if the difference between the sum of its even-placed digits and the sum of its odd-placed digits is divisible by 11.
- Slides: 26