Sum of digits of ternary and novenary numbers

83 Views Asked by At

When a natural number is represented as a ternary (base 3), the sum of the digits is 2007. What are the maximal and minimal values of the sum of digits when it is represented as a novenary (base 9)?

I have no clue.

1

There are 1 best solutions below

5
On

So first we note that to convert from ternary to novenary we simply go from the least significant digit (or "trit") and pair them up and convert each pair into a novenary digit from ternary (I'll leave it to you to see why this is case)

So really we have a bunch of pairs $\in \{0,1,2\}^2$ such that all the numbers have a fixed sum (2007 in this case), and we want to maximise the sum of all the digits when we convert to base 9. So really we want to maximise the base 9 representation of every pair.

So to make the best use of the fixed sum, we need to only put non-zero values in the first element of the pair, as that corresponds to a higher value in base 9.

Interestingly from here (again I'll leave it to you to see why), it's completely irrelevant how we distribute the sum, as the base-9 sum is always the same. So let's just do it the obvious way and have $2007$ pairs all equal to $(1,0)$, so the maximal base-9 sum is $1*3*2007 = 6021$.