How do you know if a number is even or odd?
You look at the last digit of the number; if this is even, then the whole number is even, and if it's odd, then so is the whole number.
This is fine when we're using base ten, or base twelve - or in fact any even base. How can we tell if a number is odd or even in an odd-number base?
As an example, the number 4, written in base three, is expressed as "11" - which does not look even. We need some other rule to test if a number is even, we can't just go by the last digit.
Writing out multiples of 2 in, say, base 5, we have:
2, 4, 11, 13, 20, 22, 24, 31, 33, 40, and so on. It's no good looking at the final digit - 12 in base 5 is 7 in base ten, for example. But you might notice that if we add the digits in each number in the list the total is even.
Here I want to define a function Q(x). It stands for the sum of the digits in the number x. So Q(15) = 1+5 = 6. The values of Q(x) for the numbers in the list above are 2, 4, 2, 4, 2, 4, 6, 4, 6, 4 ... all even. Is this sufficient?
Where do we find this sort of test for divisibility? If you think back to what you learnt at school, you may remember that to test if a number was divisible by 3 (in base ten) all you had to do was to add up the digits in the number; if this total could be divided evenly by 3, then so could the number itself. This test depends on the test for 9 - multiples of 9 add to 9 or a multiple of 9.
Nine is one less than ten. In other bases this "add digit" test applies to the number that is one less than the base - so in base twelve, the test for eleven is add the digits and see if the total divides by eleven; or, in base eight, the test for seven is add the digits... etc.
In other words, to test for divisibility by (b-1) or any factor of (b-1) in base b, test using Q(b-1).
In any odd number base, b, the number (b-1) is even, and our test is sufficient for checking even numbers in odd bases.
In an even base the number is odd if the last digit is odd, and even if the last digit is even.
In an odd-number base the number x is odd if Q(x) is odd, and even if Q(x) is even.
While we are on the subject of divisibility, there is also the function A(x).
This is the (positive) difference between the sums of alternate digits; for example A(124) = (1+4)-(2) = 3, A(165742) = (6+7+2) - (1+5+4) = 15 - 10 = 5.
This is the basis of the rule for testing for divisibility by eleven in base ten - or by the number (b+1) in any base b. And thus for factors of (b+1) as well.
[Footnote: the Q in Q(x) stands for Quersumme, the German term for Q(x).]
For some numbers n divides by Q(n) and by [Q(n)]2
Example (base ten) n = 162; Q(162) =9, square is 81 and 162 divides by 9 (obvious) and by 81.
But 126, 216, 261, 612 and 621 do not so divide.
The numbers (in base ten) are divisible by Q(n) and
also by its square:
162, 243, 324, 392, 405, 512, 605, 648, 810 and 972.
Investigations show that, for (1,2,3) only 132 and 312 divide by 6, (Q(123)=6) and none by 62.
For the (234) pattern, all divide by 9, but only 243 and 324 by 92, or 81.
If we change bases, then 314 (base seven) divides by 8 and 82,
134, 314, 413 and 431 do not divide by 8,
and 143 and 341 divide by 8 but not 82.
This leaves room for more investigation ..