Is this equation solvable? Bases

45 Views Asked by At

Not sure what to make the title. Let $f(x)$ represent the function that takes a hexadecimal number and returns its value in base 10. Let $x$ be a number in base 10. Can we solve $f(x) - x = y$?

For example, choose $y$ to be, say, 400,000. Then can we determine $x$? Here is what I came up with:

Express $x:= \sum_{0}^{n} a_i \cdot (10)^i$ where $a_i \in \{0, \dots, 9\}$

Then $f(x) := \sum_{0}^{n} a_i \cdot (16)^i$

Then $f(x) - x = \sum_{i=1}^n a_i \cdot ({16}^i - {10}^i)$.

At this point I think it must be brute forced? But there should always exist a unique solution, so we know if we start brute forcing, we should find an answer in finite time?


No clue what to tag or title this.

1

There are 1 best solutions below

4
On BEST ANSWER

$16^0 - 10^0 =1-1 = 0$

$16-10 = 6$

And $16^2 - 10^2 = 156$

And $16^3 - 10^3 = 3096$

And $16^5 - 10^4 = 55,536$

And $16^4 - 10^5 = 948,576$

So you want to solve $55,536a + 3,096b + 156c + 6d + 0e = 400,000$ where $0 \le a,b,c,d,e \le 9$. There may not be a solution but if there is it is unique (except for $e$) as each coefficient is more than ten times the previous.

$400,000 = 7*55,536 + 11,248$

$11,248 = 3*3,096 + 1960$.

$1960 > 10*156$.

so there is no solution.

It's worth noting that $(16 -10)=6$ will always divide $16^k -10^k$ so there can only be a solution if $6|y$. As $6\not \mid 400,000$ there is no solution for $y = 400, 000$.

But having $y$ divisible by $6$ is not enough to guarentee there will be a solution.