Every door of a nine-story building (#floor between [1,9]) has a locker working with a combination of 5 digits. Every room of the building has a number of 4 digits allocated, and the first digit represents the floor (i.e. 2XXX is on floor #2).

Two valid combinations are known to you:
Room #1304 --> 08403
Room #2320 --> 70232

Find the pattern between the number of the room and its combination in order to know every room's combination in that building.

  • $\begingroup$ any update on this? kindly post the answer if none of the given are acceptable $\endgroup$ Feb 5 '19 at 8:29
  • 1
    $\begingroup$ I'd like to see one more "valid combinations are known to you". $\endgroup$ Feb 5 '19 at 19:09

A partial answer... Slightly more than just partial maybe. Have figured out the logic for 4 out of the 5 digits. Observe this:

  • The first room: 1304 ===> 08403; The second one: 2320 ===> 70232. Just in case you didn't notice: The room number excluding the digit representing the floor number(the leading digit) is just being reversed at a particular position in the locker key.

  • Now having figured out how(not where yet) 3 digits are found, onto the 4th digit, i.e., the digit preceding these 3 digits.

  • The 8 in the first(08403) and 7 in the second(70232) is nothing but the sum of all digits of the room number: 8 = 1 + 3 + 0 + 4 and 7 = 3 + 2 + 3 + 0

  • Now that we've seen what the 4 digits are, let's see in what positions they appear.

  • the floor number is what decides where the previously found 4 digits start to be filled. In the first example: floor #1 ===> the digits 3048 starts getting filled from the 1st position from the end, in other words... units place. In the second, numbering starts from the second position from the end(the Tenths place).

The logic for finding and locating these 4 digits should be working fine for all 9 floors. But 6th to 9th floors would be different from the 1st to 5th based on the 5th digit, which I haven't been able to figure out yet.

  • $\begingroup$ That's a perfect start. You are close from getting it! $\endgroup$
    – Yormu
    Feb 6 '19 at 14:03
  • $\begingroup$ thanks @Yormu.. any hint as for the 5th digit? $\endgroup$ Feb 7 '19 at 3:54

This probably isn't the answer, but here is my take on this

$$ y=round({61829x\over1016} - {9010946\over127}) $$ Where $x$ is the room number and $y$ is the number combination. $x$ will always be 4 digits. If $y$ is less than 5 digits, it is then padded with zeroes till it is 5 digits. Example: $873$ to $00873$

  • $\begingroup$ Is this a 5 digit number? $\endgroup$ Feb 3 '19 at 23:52
  • $\begingroup$ @deepthought what is the 'this' in your question? $\endgroup$
    – Gymhgy
    Feb 4 '19 at 1:21
  • $\begingroup$ Well I'm trying to talk around the spoiler block... (I could use rot13, but I am being lazy). I would point out that room numbers are 4 digits and that combinations are 5 digits. $\endgroup$ Feb 4 '19 at 1:27
  • $\begingroup$ @deepthought added some clarification $\endgroup$
    – Gymhgy
    Feb 4 '19 at 1:31
  • $\begingroup$ I think the point is that we're supposed to be able to find "every room's combination in that building". So for example if I'm next door to 1304. What's the combination for 1305? What if I'm above 2320, what's the combination for 3320? $\endgroup$ Feb 4 '19 at 1:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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