When two digits of thbase 10 representation of an inteer are intercharged, the diference bewen the old number and the new number is divisible by 9. Why? What happens in other bases?

10A + B - 10B -A= difference.

This reduces to
9A - 9B
9(A-b)= difference.

Of course it is divisible by 9, it has a nine in it. Now what happens in other bases. Try this logic on say base 8.

In base 8, we have 8 different digits (0 to 7) instead of 10 digits in base 10. Let's apply the same logic we used in base 10 to understand what happens in other bases, such as base 8.

Assume we have two digits A and B in base 8, and we interchange their positions. So the original number can be written as 8A + B, and the new number as 8B + A. Subtracting the new number from the original number gives us:

(8A + B) - (8B + A) = 7A - 7B

Now, notice that both 7A and 7B are divisible by 7. Therefore, the difference between the old number and the new number, which is 7A - 7B, is also divisible by 7.

The same logic can be applied to any base. In base n, where n is the number of digits in the base, the old number can be written as nA + B, and the new number as nB + A. Subtracting the new number from the old number gives us:

(nA + B) - (nB + A) = (n-1)A - (n-1)B

Since (n-1)A and (n-1)B are both multiples of (n-1), the difference between the old number and the new number, which is (n-1)A - (n-1)B, is divisible by (n-1).

So, in summary, when two digits of the base n representation of an integer are interchanged, the difference between the old number and the new number is divisible by (n-1).