Wednesday, December 25, 2019

number theory - Divisibility tests for 10npm1



I'm looking for a divisibility test for numbers of the form 10n±1



I need the test to be a summation across digits like the one for 11, that being, a number ¯dnd1 is divisible by 11 if

\sum_{i \; even} d_{i+1} - d_i \pmod{11} = 0



I'm after a similarly styled test for all 10n \pm1. Is there a nice way to generate them?



Thanks in advance for your help!


Answer



Example for the number 19 : The order of 10 modulo 19 is 18, therefore you can divide the given number into 18-digit-blocks from behind. The first block usually will have less than 18 digits. Then, you can sum up the residues modulo 19 of those blocks (considered as a natural number) and the given number is divisible by 19 if and only if the sum is divisible by 19.



A bit easier to use is the following rule : Divide the number into 9-digit blocks from behind, the first block usually will have less than 9 digits. Then, begin with residue modulo 19 of the first block, then subtract the residue of the next, then add and so on. The given number is divisible by 19 , if and only if the final result is divisible by 19.




Example : 5645012950185238747288629



Dividing gives 5645012\ 950185238747288629



5645012 has redisue 17 and 950185238747288629 has redisue 2 , the sum is 19. Hence , the given number is disible by 19



5645012\ 950185238\ 747288629



If we divide in 9-digit - blocks, we get the residues 17,7,9 and 17-7+9=19 which is divisible by 19, hence the given number is disivible by 19.


No comments:

Post a Comment

analysis - Injection, making bijection

I have injection f \colon A \rightarrow B and I want to get bijection. Can I just resting codomain to f(A)? I know that every function i...