3
$\begingroup$

We have a hexadecimal number (base 16 - the digits are 0123456789ABCDEF), that is 16 digits long (digits can repeat). Our number has these features:

  • the first digit shows us how many digits of the number are 0's,

  • the second digit shows us how many digits are 1's,

  • and so on, until the last (16th) digit shows us how many digits are F's (15's).

Your job is to find out our number. Best written full answer (number + how you got it) wins!

$\endgroup$
1
  • 2
    $\begingroup$ You still use the same approach to solving. And E isn't 15, F is. $\endgroup$
    – bg6471
    Commented Sep 13, 2016 at 23:58

2 Answers 2

4
$\begingroup$

Rand's found an answer, and the technique he used is very effective for this sort of puzzle, but perhaps it's worth seeing whether his is the only answer. So let's go at it from first principles.

The total number of digits is 16. Therefore the sum of all the digits is 16. Therefore the sum of (digit*position) is 16. Therefore the second half of the number contains at most one nonzero digit. If it contains none then we have 8 zeros and therefore at least one digit >= 8, contradiction, so the second half of the number contains exactly one nonzero digit and (equivalently) there is exactly one digit that occurs at least 8 times.

If we have seven or more nonzero digits then the sum of (digit*position) is at least 0+1+2+3+4+5+6=21>16, contradiction; so in fact there are at most six non0s and at least nine 0s (and so the first digit is at least 9). In fact, if we have six or more nonzero digits then, since one of them is at least 9, that sum is at least 0+1+2+3+4+9=19, contradiction. So there are at least eleven 0s and the first digit is at least B. Now, if we have five or more nonzero digits then since one of them is at least B the sum is at least 0+1+2+3+11=17, still impossible. So in fact there are at least twelve 0s and at most four nonzeros. (One of which is of course a C or more in position 0.)

At this point we've reduced the possibilities enough for a computer search to be effective, but it would be nice to finish it off by hand. Let's see. There are at most four nonzeros, so no nonzero digit can occur >4 times, so no position >4 (other than whichever one counts the zeros) is nonzero. If position 4 is nonzerothen there is at least one 4, so at most three of anything else nonzero, and clearly there cannot be four 4s, so nothing occurs 4 times, contradiction. So now we have at most positions 0,1,2,3 nonzero, together with whatever position counts the 0s.

There is exactly one of whichever digit counts the 0s, so position 1 is occupied. What by? Not a 1 because then we have exactly one 1 and exactly one whatever-counts-zeros, hence at least two 1s, contradiction; hence by a 2 or a 3. If by a 3 then we must have three of something, but whatever it is will make our total too high. So position 1 contains a 2, there are exactly two 1s, and now we have 1+1+2+[>=C]+[others]=16, so position 0 contains a C and other positions are full of zeros. And now we are done because we have all the counts.

Specifically, we have twelve 0s, two 1s, one 2, and one C, and our number is C210,0000,0000,1000. In other words, Rand's solution is the only one.

$\endgroup$
3
  • $\begingroup$ You cover the part that @rand does not. Add a complete answer if you want to get your answer accepted. +1 for your effort. $\endgroup$
    – user21233
    Commented Sep 14, 2016 at 13:31
  • $\begingroup$ I'd feel kinda bad having this accepted when Rand got the actual answer long before I wrote any of it. But I'll add the extra material required to make it self-contained anyway. $\endgroup$
    – Gareth McCaughan
    Commented Sep 14, 2016 at 13:53
  • $\begingroup$ You were the only one to cover the WHOLE problem - I specifically stated that Best written full answer (number + how you got it) wins!. You win. Dot. $\endgroup$
    – user21233
    Commented Sep 14, 2016 at 14:09
13
$\begingroup$

Let's try the same method as used in the solution of the previous (base 10) question.

  • Start with F000,0000,0000,0000 (using comma spacing for clarity).

  • This has one F, so change to F000,0000,0000,0001.

  • This has one 1, so change to F100,0000,0000,0001.

  • This has two 1's, so change to F200,0000,0000,0001.

  • This has one 2, so change to F210,0000,0000,0001.

  • This has twelve 0's, so change to C210,0000,0000,0001.

  • This has one C and no F's, so change to C210,0000,0000,1000.

The final answer is

C210,0000,0000,1000.

$\endgroup$
3
  • $\begingroup$ Is this the only answer? If yes, why? $\endgroup$
    – user21233
    Commented Sep 14, 2016 at 13:00
  • $\begingroup$ @Rudolf Gareth has proved in his answer that my solution is unique. I could have started from a general 16-digit number and gradually added restrictions until eventually I got down to this number as the sole solution, but it would've been less elegant albeit more rigorous. $\endgroup$ Commented Sep 14, 2016 at 13:20
  • $\begingroup$ I partially agree with you, but that way you give me a slightly incomplete answer. Anyway, +1 for you. $\endgroup$
    – user21233
    Commented Sep 14, 2016 at 13:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.