The mysterious coffer

Archaeologists had found a coffer containing jewelry. Unfortunately, the coffer has a code, which is a digit (from 0 0 to 9 9 ). After every wrong attempt, the code increases by one (if the code was 9 9 , it changes to 0 0 ). If you try the same digit twice (at any point in time), the coffer explodes.

Is it possible that we can always open the coffer?

No, it is not possible Yes, it is possible

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

3 solutions

Albert Yiyi
Jun 23, 2018

i interpret the problem as follow:

  1. the code can be a single digit 0~9.

  2. you cannot input same number twice. as a consequence, you can input at most 10 times. (0~9)

  3. every wrong attempt, the code cycles from 0~9 and back to 0.

under worse case scenario, is there a guaranteed way to enter the correct code?

the answer is no. here is the reason.

  1. notice that in worse case scenario, we need input at least 10 times. hence, we focus on eliminating the possible code at last (10th) attempt.

  2. during 1 st attempt, say we input 3 and its wrong, then last attempt the code is not 3 - 1 = 2 . we know this by tracking incorrect input 3 cycling through 4~9 and 0~2.

  3. during 2 nd attempt, say we input 0 and its wrong, then last attempt the code is not 0 - 2 == 8 (mod 10) by same reasoning.

  4. in general, during n -th attempt, we input a and its wrong, then last attempt the code is not (a-n) mod 10 .

  5. let a n a_n be the input during n-th attempt, let b n b_n be the eliminated code on last attempt. so the examples in step 2 and 3 translate into: a 1 = 3 , b 1 = a 1 1 = 3 1 = 2 a 2 = 0 , b 2 = a 2 2 = 0 2 8 a_1 = 3 , \ b_1 = a_1 - 1 = 3 - 1 = 2 \\ a_2 = 0 , \ b_2 = a_2 - 2 = 0 - 2 \equiv 8

  6. during last attempt, we wish to "cover" all cases. the goal is to find a n = 0 9 a_n = 0 \sim 9 and b n = 0 9 b_n = 0 \sim 9 such that a n n b n ( mod 10 ) a_n - n \equiv b_n \ (\text{mod } 10) for n = 1 10 n = 1 \sim 10

  7. assume this can be done, we sum up b n b_n on one hand, b n = 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 = 45 5 ( mod 10 ) on the other hand, b n = ( a n n ) = a n n = 45 55 = 10 0 ( mod 10 ) b n 5 0 ( mod 10 ) \begin{aligned} \text{on one hand, } \sum b_n &= 0+1+2+3+4+5+6+7+8+9 \\ &= 45 \\ &\equiv 5 \ (\text{mod } 10) \\ \ \\ \text{on the other hand, } \sum b_n &= \sum (a_n - n) \\ &= \sum a_n - \sum n \\ &= 45 - 55 \\ &= -10 \\ &\equiv 0 \ (\text{mod } 10) \\ \therefore \sum b_n \equiv 5 \equiv 0 \ (\text{mod } 10) \end{aligned}

we arrive a contradiction, hence there is no guarantee way to enter the correct code.

You have all the essential ingredients for a complete solution.

Note: Saying "notice that in worst case scenario ..." isn't a great way to start this solution (because you have to define what the worst case scenario really is, and explain concretely that's the worst possible case, which could get hard to defend).
Instead, start off with a proof by contradiction. Suppose that there is a way to break the code using some algorithm. If it takes us less than 10 steps, we will arbitrarily fill in the rest of the steps with the rest of the missing numbers.

Calvin Lin Staff - 2 years, 11 months ago

Log in to reply

yes, im struggling to convey my thoughts, english is not my first language. i welcome other people to improve my explanation and post their own solutions.

albert yiyi - 2 years, 11 months ago
Affan Morshed
Nov 9, 2018

Every time you try you are, in essence, trying to deduce the starting point while either leaving the option to choose the starting point or to select the starting point directly. Each time you try, you eliminate a possible starting state (ST). There is no way of knowing which state it started at until either you win the game by chance, or you have tried 9 times. After you have finished 9 times, do note that the code would be 1 less than the true ST, which you may have tried previously (after all, you had no way to guarantee that the true ST was the true ST).

Zoe Codrington
Nov 8, 2018

Say we begin by guessing 1. We are incorrect and the code moves up one. We then guess it was originally 2(and now 3). Getting it wrong, we would guess: Guess 1:1 Guess 2:3 Guess3:5 Guess 4:7 Guess 5:9 Guess 6: At this point we would guess one but instead we would skip this and assume it was 7 Guess 6:2 Guess 7:4 Guess 8:6 If all these are incorrect then we have entered 7 incorrect answers and the original code was 6. So we would be forced to guess 3(correct, but blows up coffer) Luckily, with this method we have an 8/9 chance of getting it but still... Oh and to work out the three in the last answer I calculated(7+6)mod10=13mod10.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...