[Math] quick parity test for integers expressed with odd radicies

divisibilityelementary-number-theory

For integers expressed with an odd base, is there an easy way to tell if the number is odd or even?

For an even base, if the ones digit is even, so is the integer. But this doesn't hold true for odd bases. For example, in base 3, 22 is even and 12 is odd.

One can always divide by two and see if there is a remainder. I've found (but don't have the mathematical background to formally prove) that, for odd bases, the parity of the sum of the digits is the parity of the number.

But is there any easier way to tell, just by looking? (Assume there are lots of digits.)

Best Answer

Given the simple facts that even+even=even, even+odd=odd, and odd+odd=even, we can see that if there are an even number of odd digits, the sum of the digits is even and if there is a odd number of odd digits, the sum of the digits is odd.

So, rather than summing the digits, you can simply count the number of odd digits, which has the same parity as the number itself.

Related Question