Background:
I gave an exam recently and parts of it involved converting values expressed in hexadecimal to decimal. Seven people did these conversions the same wrong way, which I'll demonstrate by example below:
(ASIDE: Five others just crammed the individual digit conversions together to get 2313154.)
Puzzle:
While this conversion technique is clearly wrong in general, for small hexadecimal values it results in decimal results that are too large, while for sufficiently large hexadecimal values it results in decimal values that are too small. This raises the question of if there are any hexadecimal values for which this technique, by coincidence, happens to produce the correct hexadecimal values. An obvious, and trivial, case is 0x0, so we will exclude that from further consideration.
Writing a program to search the space is very easy -- though one person that tried that didn't search a large enough space and concluded that there were no nontrivial solutions.
So the challenge of the puzzle is to, by analysis, answer as many of the following questions as possible:
Are there any nontrivial solutions?
And, yes, the comment above reveals the answer to this question, but it's not enough to just say, "Yes," you have to actually prove it.
Assuming that there are non-trivial solutions:
Can you find a nontrivial solution (and, if so, what is it)?
How many nontrivial solutions are there?
What is the largest value that you can prove is a lower bound on nontrivial solutions?
What is the smallest value that you can prove is an upper bound on nontrivial solutions?
What is the smallest non-trivial solution?
What is the largest non-trivial solution?
To avoid spoiling the fun too quickly, don't give actual solutions, but instead supply a simple 'hash' for them as follows:
Sum up the digits in the hex value, each multiplied by i where i = 1 for the least significant digit and increases by one for each digit to it's left.
Sum up the digits in the dec value, each multiplied by i where i = 1 for the least significant digit and increases by two for each digit to it's left.
The hash is the sum of these two sums.
For example, if you claim that the example above, namely 0x23DF4 = 391264, is a solution, you would calculate the hash as follows:
h(0x23DF4) = (2*5) + (3*4) + (13*3) + (15*2) + (4*1) = 95
h(391264) = (3*12) + (9*10) + (1*8) + (2*6) + (6*4) + (6*2) = 182
hash = 95 + 182 = 277
At first, let's apply this same approach for posting your bounding limits. In about a week you can reveal actual values for both solutions and limits, as well as the approach you used.
Remember, the point is to NOT just write a program to do a brute-force search, but to do it with pencil and paper and nothing more than the capabilities of a four-function calculator.
EDIT: Fix typos - Thanks, Ya'akov.
I gave an exam recently and parts of it involved converting values expressed in hexadecimal to decimal. Seven people did these conversions the same wrong way, which I'll demonstrate by example below:
Code:
0x23DF4
2 3 D F 4
| | | | |
2 3 13 15 4
4 x 16 = 64
15 x 16 = 240
13 x 16 = 208
3 x 16 = 48
2 x 16 = 32
64
240
208
48
32
---------
391264
Puzzle:
While this conversion technique is clearly wrong in general, for small hexadecimal values it results in decimal results that are too large, while for sufficiently large hexadecimal values it results in decimal values that are too small. This raises the question of if there are any hexadecimal values for which this technique, by coincidence, happens to produce the correct hexadecimal values. An obvious, and trivial, case is 0x0, so we will exclude that from further consideration.
Writing a program to search the space is very easy -- though one person that tried that didn't search a large enough space and concluded that there were no nontrivial solutions.
So the challenge of the puzzle is to, by analysis, answer as many of the following questions as possible:
Are there any nontrivial solutions?
And, yes, the comment above reveals the answer to this question, but it's not enough to just say, "Yes," you have to actually prove it.
Assuming that there are non-trivial solutions:
Can you find a nontrivial solution (and, if so, what is it)?
How many nontrivial solutions are there?
What is the largest value that you can prove is a lower bound on nontrivial solutions?
What is the smallest value that you can prove is an upper bound on nontrivial solutions?
What is the smallest non-trivial solution?
What is the largest non-trivial solution?
To avoid spoiling the fun too quickly, don't give actual solutions, but instead supply a simple 'hash' for them as follows:
Sum up the digits in the hex value, each multiplied by i where i = 1 for the least significant digit and increases by one for each digit to it's left.
Sum up the digits in the dec value, each multiplied by i where i = 1 for the least significant digit and increases by two for each digit to it's left.
The hash is the sum of these two sums.
For example, if you claim that the example above, namely 0x23DF4 = 391264, is a solution, you would calculate the hash as follows:
h(0x23DF4) = (2*5) + (3*4) + (13*3) + (15*2) + (4*1) = 95
h(391264) = (3*12) + (9*10) + (1*8) + (2*6) + (6*4) + (6*2) = 182
hash = 95 + 182 = 277
At first, let's apply this same approach for posting your bounding limits. In about a week you can reveal actual values for both solutions and limits, as well as the approach you used.
Remember, the point is to NOT just write a program to do a brute-force search, but to do it with pencil and paper and nothing more than the capabilities of a four-function calculator.
EDIT: Fix typos - Thanks, Ya'akov.
Last edited: