14

I still remember the feeling, when I learned that a number is divisible by 3, if the digit sum is divisible by 3. The general way to get these rules for the regular decimal system is asked/answered here: Divisibility rules and congruences. Now I wonder, what divisibility rules an alien with 12 (or 42) fingers would come up with?

So let n=kckbk be the representation with base b. Looking at some examples shows indicate that n is divisible by b1, if kck is. This seems to be a poor man's extension to the decimal divisibility by 9 rule.

The answer to the above mentioned question, says that "One needn't memorize motley exotic divisibility tests. ". Motley exotic divisibility tests are very welcome here!

7
  • 3
    I don't think there any general tests other than minor variations on the method I describe there, viz. modulo the divisor, (Horner) evaluate the radix polynomial (or a convenient scaling or rearrangement of it). Every divisibility test I've seen can be viewed as a special case of this. That was the point of my answer there. Commented May 23, 2012 at 15:17
  • 6
    I am reminded yet again of an anecdote told by one of my professors: one time, an engineer came to his office very excited, because he had come up with a very easy general divisibility test. He pointed out that checking divisibility by 10 was very easy, because you only have to look at the last digit and see if it is zero or not. So his method was: to test whether n is divisible by b>1, write n in base b and check the last digit: if it is 0, then n is divisible by b; if not, then n is not divisible by b. Commented May 23, 2012 at 18:19
  • @ArturoMagidin I thought about to exclude the engineer case in the body of the question. Commented May 23, 2012 at 18:24
  • @BillDubuque as you've kindly offered in a comment below, I would be also very happy if could explain this a little further. Commented May 24, 2012 at 8:16
  • 1
    Sounds a good question for Worldbuilding site as well. Commented Aug 5, 2023 at 17:06

3 Answers 3

7

Claim 1:

The divisibility rule for a number 'a' to be divided by 'n' is as follows. Express the number 'a' in base 'n+1'. Let 's' denote the sum of digits of 'a' expressed in base 'n+1'. Now n|an|s. More generally, as(modn).

Example:

Before setting to prove this, we will see an example of this. Say we want to check if 13|611. Express 611 in base 14.

611=3×142+1×141+9×140=(319)14
where (319)14 denotes that the decimal number 611 expressed in base 14. The sum of the digits s=3+1+9=13. Clearly, 13|13. Hence, 13|611, which is indeed true since 611=13×47.

Proof:

The proof for this claim writes itself out. Let a=(amam1a0)n+1, where ai are the digits of 'a' in the base 'n+1'.

a=am×(n+1)m+am1×(n+1)m1++a0
Now, note that
n+11(modn)(n+1)k1(modn)ak×(n+1)kak(modn)
a=am×(n+1)m+am1×(n+1)m1++a0(am+am1+a0)(modn)as(modn)
Hence proved.

Claim 2: The divisibility rule for a number 'a' to be divided by 'n' is as follows. Express the number 'a' in base 'n1'. Let 's' denote the alternating sum of digits of 'a' expressed in base 'n1' i.e. if a=(amam1a0)n1, s=a0a1+a2+(1)m1am1+(1)mam. Now n|a if and only n|s. More generally, as(modn).

Example:

Before setting to prove this, we will see an example of this. Say we want to check if 13|611. Express 611 in base 12.

611=4×122+2×121+B×120=(42B)12
where (42B)14 denotes that the decimal number 611 expressed in base 12, A stands for the tenth digit and B stands for the eleventh digit. The alternating sum of the digits s=B122+4=13. Clearly, 13|13. Hence, 13|611, which is indeed true since 611=13×47.

Proof:

The proof for this claim writes itself out just like the one above. Let a=(amam1a0)n+1, where ai are the digits of 'a' in the base 'n1'.

a=am×(n1)m+am1×(n1)m1++a0
Now, note that
n1(1)(modn)(n1)k(1)k(modn)ak×(n1)k(1)kak(modn)
a=am×(n1)m+am1×(n1)m1++a0((1)mam+(1)m1am1+a0)(modn)as(modn)
Hence proved.

Pros and Cons:

The one obvious advantage of the above divisibility rules is that it is a generalized divisibility rule that can be applied for any 'n'.

However, the major disadvantage in these divisibility rules is that if a number is given in decimal system we need to first express the number in a different base. Expressing it in base n1 or n+1 may turn out to be more expensive. (We might as well try direct division by n instead of this procedure!). However, if the number given is already expressed in base n+1 or n1, then checking for divisibility becomes a trivial issue.

1
  • 1
    @draks This is a just a special case of the universal method that I described in the answer you linked to - see my comment to your question. If that was not clear to you then I would have been happy to explain further. The special cases are much easier to understand (and remember!) when viewed from this more general perspective. Commented May 23, 2012 at 23:44
3

The test for base-10 divisibility by 11 has a straightforward analogue in other bases. For example, in base 12, 756899 is divisible by 13 because 7+6+9 = 5+8+9. One can extend this to a case that doesn't arise in base 10 because 10+1 is prime: If n is any factor of b+1, then one can test for divisibility by n in base b by forming the two alternate-digit sums and checking if they differ by a multiple of n. For example consider base 8. Is the number 71668 divisible by 3? It is if and only if 7+6 and 1+6 differ by a multiple of 3; obviously, they do, so the answer is yes.

The tests for divisibility by 2 and 5 have analogues in non-prime bases. For example, in base 12, numbers are divisible by 6 if and only if they end in 0 or 6; divisible by 4 if and only if they end in 0, 4, or 8; by 3 if and only if they end in 0, 3, 6, or 9; and by 2 if and only if they in 0, 2, 4, 6, 8, or A. Similarly the test for divisibility by 10 has an obvious analogue. In general, if n divides b, then a base-b number X is divisible by n if and only if its last digit is divisible by n.

The test for divisibility by 3 has analogues in bases n where n1 is not prime; if n1 is divisible by k, you can check for divisibility by k by adding up the base-n digits and checking if the sum is divisible by k. For example, consider 82A in base 11. The sum of these digits is 20, which is even, and is also a multiple of 5; both 2 and 5 divide 11-1=10, so 82A is a multiple of both 5 and 2. But the sum of the digits in 654 is 15, a multiple of 5 but not of 2, so 654 is a multiple of 5 but not of 2.

3
  • 1
    I think I have more to say about this. For example, on the way home I noticed that there is a not-too-awful test for divisibility by 7 in base 9. Consider 2280724829. Divide the digits into groups of three and sum the groups mod 7: 2+0+4=6; 2+7+8=17=3; 8+2+2=12=5. Then calculate 6·4+3·2+5 = 35. This is a multiple of 7, so the original number was also a multiple of 7. I will try to write up the general method in more detail later, or perhaps you can infer it from what Bill wrote above. Commented May 23, 2012 at 21:51
  • Now it get's motley... Commented May 24, 2012 at 8:14
  • Are you still working on the more general method? I would really be interested... Commented Jun 9, 2012 at 15:35
2

Here is a divisibility rule for d in base b, given d and b are relatively prime.

Let k be any integer such that kb1(modd). Take the last digit of the number we're testing, multiply it by k, and add it to the remaining digits, not including the last digit. Then repeat the process with the new number formed. Note that all calculations are done in base b.

For example, to find if a number, say 552839, is divisible by 7 in base 10, we can set k=2, since (2)10=201(mod7). Then we get the following sequence:

55283955265551653935

Since 35 is divisible by 7, then the original number 552839 is also divisible by 7.

Edit - Explanation: We are essentially just repeatedly converting a number of the form nb+m into n+km. Since

nb+mb(n+km)(modd)
and b and d are relatively prime, d|(n+km) if and only if d|(nb+m), allowing the substitution.

3
  • 1
    Can you please explain how and why this method works? Commented Sep 26, 2023 at 4:07
  • thank you so much, this is exactly what i was looking for and you condensed it. i will edit the answer to include the proof and intuition when i have the time Commented Jun 2, 2024 at 0:39
  • @user471651 I added an explanation. Commented Aug 2, 2024 at 22:14

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.