22
$\begingroup$

Jeremy is a store owner. He uses combination locks like the one below at all of his store locations to secure cabinets of semi-important documents. Each combination is made up of 3 numbers, each between 0 and 39, inclusively.

enter image description here

Over the years as he built more stores, Jeremy developed a system for remembering the combination at each store location. His secret: He associates a trip with each combination.

Here are a couple of examples:

For his original store, the trip he remembers is

Belgium --> Germany --> France, and the combination is 10-17-29.

For his second store, the trip he remembers is

Saudi Arabia--> Iran --> Qatar, and the combination is 38-13-35.

You work at Jeremy's new location, and the cabinet there has 2 combination locks on it. He is always looking for people with excellent problem-solving skills to promote to top managerial positions within the company. With that in mind, he has told you which trips he associates with each lock. Knowing his motivation, you would love to be able to figure out both of the combinations and get a much better job.

The trip for lock #1 is

Brazil --> Chile --> Argentina

The trip for lock #2 is

Everywhere --> Nowhere --> Home

The numbers correspond to the areas traveled, and they are in order. Each area traveled has one and only one number associated with it. The process is not super complicated. It doesn't require arithmetic mod and it doesn't require knowledge of provinces, states, zones, or regions. In response to Oren's comment, all countries and many other areas (except 5 of them, which is an unimportant detail), can be turned into a valid number.

Tip: Ignore lock #2 at first, and when you have figured out a method, apply it to lock #1. Then, apply a small amount of practical/creative/lateral thinking (not calculation, as for the other locks) to get lock #2.

EDIT: Extra Info: Jeremy is horrible at spelling, but he is great at remembering short nicknames, abbreviations, and the like.

What are the 2 combinations, and why?


$\endgroup$
  • 7
    $\begingroup$ "Calling code for Germany (49) minus calling code for Belgium (32) is 17! I must be getting close!" - me, seconds before realizing there is no calling code for "everywhere." $\endgroup$ – Curmudgeon Jul 6 '15 at 18:49
  • 2
    $\begingroup$ Does the combination for the trip Saudi Arabia -> Germany -> France is 38-17-29 ? $\endgroup$ – TroyAndAbed Jul 6 '15 at 19:49
  • 6
    $\begingroup$ @TroyAndAbed Yes. More specifically, the numbers correspond to the areas traveled, and they are in order. And yes, this comment is a hint. $\endgroup$ – JLee Jul 6 '15 at 19:54
  • 2
    $\begingroup$ @VictorStafusa OK thanks. I will work them into the question, because many people here on this site frown upon hints, and think (usually rightly) that a puzzle that needs hints is not a good puzzle. $\endgroup$ – JLee Jul 7 '15 at 21:40
  • 4
    $\begingroup$ @JLee I want you to know that this puzzle has been driving me absolutely crazy all day. I hope you're proud of yourself. $\endgroup$ – VictorHenry Jul 8 '15 at 3:43
2
+100
$\begingroup$

Posting Cerberus' explanation verbatim to explain the rules required to understand lock 1 (and so multiple answers don't have to be referenced).

You need to take the three-letter code of each country and calculate the 'distance' (d) between 2 consecutive letters, and finally add them.

Belgium --> Germany --> France

BEL --> DEU --> FRA
d(B,E) + d(E,L) = 3 + 7 = 10
d(D,E) + d(E,U) = 1 + 16 = 17
d(F,R) + d(R,A) = 12 + 17 = 29

Saudi Arabia --> Iran --> Qatar

SAU --> IRN --> QAT
d(S,A) + d(A,U) = 18 + 20 = 38
d(I,R) + d(R,N) = 9 + 4 = 13
d(Q,A) + d(A,T) = 16 + 19 = 35

That means that Brazil --> Chile --> Argentina

BRA --> CHL --> ARG
d(B,R) + d(R,A) = 16 + 17 = 33
d(C,H) + d(H,L) = 5 + 4 = 9
d(A,R) + d(R,G) = 17 + 11 = 28
so the code is 33-9-28


Quark's solution to Lock 2:

Nowhere is 0, Everywhere is 39, and Home is 1.

/* Author: Quark */

#include <stdio.h>
#include <strings.h>

int main()
{
    char code[4];
    int number[3];
    int value;
    int i;
    int zero=0,one=0,two=0,three=0,four=0,five=0,six=0,seven=0,eight=0,nine=0,ten=0,
        eleven=0,twelve=0,thirteen=0,fourteen=0,fifteen=0,sixteen=0,seventeen=0,
        eighteen=0,nineteen=0,twenty=0,twentyone=0,twentytwo=0,twentythree=0,twentyfour=0,
        twentyfive=0,twentysix=0,twentyseven=0,twentyeight=0,twentynine=0,thirty=0,
        thirtyone=0,thirtytwo=0,thirtythree=0,thirtyfour=0,thirtyfive=0,thirtysix=0,
        thirtyseven=0,thirtyeight=0,thirtynine=0,fourty=0,over = 0;

    while(1){
        gets(code);
        if(code[0]=='0')
            printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n", zero,one,two,three,four,five,six,seven,eight,nine,ten,
        eleven,twelve,thirteen,fourteen,fifteen,sixteen,seventeen,
        eighteen,nineteen,twenty,twentyone,twentytwo,twentythree,twentyfour,
        twentyfive,twentysix,twentyseven,twentyeight,twentynine,thirty,
        thirtyone,thirtytwo,thirtythree,thirtyfour,thirtyfive,thirtysix,
        thirtyseven,thirtyeight,thirtynine,fourty,over);

        for(i=0;i<3;i++)
        {
            if (code[i] >= 'A' && code[i] <= 'Z')
                number[i] = code[i] - 'A' + 1;
            else if (code[i] >= 'a' && code[i] <= 'z')
                number[i] = code[i] - 'a';
        }
        value = abs(number[0]-number[1]) + abs(number[1]-number[2]);
        printf("%d\n", value);
        switch(value)
        {
        case 0:
        zero++;
        break;

        case 1:
        one++;
        break;

        case 2:
        two++;
        break;

        case 3:
        three++;
        break;

        case 4:
        four++;
        break;

        case 5:
        five++;
        break;

        case 6:
        six++;
        break;

        case 7:
        seven++;
        break;

        case 8:
        eight++;
        break;

        case 9:
        nine++;
        break;

        case 10:
        ten++;
        break;

        case 11:
        eleven++;
        break;

        case 12:
        twelve++;
        break;

        case 13:
        thirteen++;
        break;

        case 14:
        fourteen++;
        break;

        case 15:
        fifteen++;
        break;

        case 16:
        sixteen++;
        break;

        case 17:
        seventeen++;
        break;

        case 18:
        eighteen++;
        break;

        case 19:
        nineteen++;
        break;

        case 20:
        twenty++;
        break;

        case 21:
        twentyone++;
        break;

        case 22:
        twentytwo++;
        break;

        case 23:
        twentythree++;
        break;

        case 24:
        twentyfour++;
        break;

        case 25:
        twentyfive++;
        break;

        case 26:
        twentysix++;
        break;

        case 27:
        twentyseven++;
        break;

        case 28:
        twentyeight++;
        break;

        case 29:
        twentynine++;
        break;

        case 30:
        thirty++;
        break;

        case 31:
        thirtyone++;
        break;

        case 32:
        thirtytwo++;
        break;

        case 33:
        thirtythree++;
        break;

        case 34:
        thirtyfour++;
        break;

        case 35:
        thirtyfive++;
        break;

        case 36:
        thirtysix++;
        break;

        case 37:
        thirtyseven++;
        break;

        case 38:
        thirtyeight++;
        break;

        case 39:
        thirtynine++;
        break;

        case 40:
        fourty++;
        break;

        default:
        over++;
        break;

        }
    }
    return(1337);
}

Running this code with a list of country codes returns:

AFG
6
ALA
22
ALB
21
DZA
47
ASM
24
AND
23
AGO
14
AIA
16
ATG
32
ARG
28
ARM
22
ABW
22
AUS
22
AUT
21
AZE
46
BHS
17
BHR
16
BGD
8
BRB
32
BLR
16
BEL
10
BLZ
24
BEN
12
BMU
19
BTN
24
BOL
16
BIH
8
BWA
43
BRA
33
VGB
20
BRN
20
BGR
16
BFA
9
BDI
7
KHM
8
CMR
15
CAN
15
CPV
19
CYM
34
CAF
7
TCD
18
CHL
9
CHN
11
HKG
7
MAC
14
COL
15
COM
14
COG
20
COK
16
CRI
24
CIV
19
HRV
14
CUB
37
CYP
31
CZE
44
PRK
9
COD
23
DNK
13
DJI
7
DMA
21
DOM
13
ECU
20
EGY
20
SLV
17
GNQ
10
ERI
22
EST
15
ETH
27
FRO
15
FLK
7
FJI
5
FIN
8
FRA
29
GUF
29
PYF
28
GAB
7
GMB
17
GEO
12
DEU
17
GHA
8
GIB
9
GRC
26
GRL
17
GRD
25
GLP
9
GUM
22
GTM
20
GGY
18
GIN
7
GNB
19
GUY
18
HTI
23
VAT
40
HND
16
HUN
20
ISL
17
IND
15
IDN
15
IRN
13
IRQ
10
IRL
15
IMN
5
ISR
11
ITA
30
JAM
21
JPN
8
JEY
25
JOR
8
KAZ
35
KEN
15
KIR
11
KWT
15
KGZ
23
LAO
25
LVA
31
LBN
22
LSO
11
LBR
26
LBY
33
LIE
7
LTU
9
LUX
12
MDG
12
MWI
24
MYS
18
MDV
27
MLI
4
MLT
9
MHL
9
MTQ
10
MRT
7
MUS
10
MYT
17
MEX
27
FSM
19
MDA
12
MCO
22
MNG
8
MNE
10
MSR
7
MAR
29
MOZ
13
MMR
5
NAM
25
NRU
7
NPL
6
NLD
10
ANT
19
NCL
20
NZL
26
NIC
11
NER
22
NGA
13
NIU
17
NFK
13
MNP
3
NOR
4
PSE
17
OMN
3
PAK
25
PLW
15
PAN
28
PNG
9
PRY
9
PER
24
PHL
12
PCN
24
POL
4
PRT
4
PRI
11
QAT
35
KOR
7
REU
29
ROU
9
RUS
5
RWA
27
BLM
11
SHN
17
KNA
16
LCA
11
MAF
17
SPM
6
VCT
36
WSM
10
SMR
11
STP
5
SAU
38
SEN
23
SRB
17
SYC
28
SLE
14
SGP
21
SVK
14
SVN
11
SLB
17
SOM
6
ZAF
30
ESP
17
LKA
11
SDN
25
SUR
5
SJM
12
SWZ
7
SWE
22
CHE
8
SYR
13
TJK
11
THA
19
MKD
9
TLS
15
TGO
21
TKL
10
TON
6
TTO
5
TUN
8
TUR
4
TKM
11
TCA
19
TUV
2
UGA
20
UKR
17
ARE
30
GBR
21
TZA
31
USA
20
VIR
22
URY
10
UZB
29
VUT
2
VEN
26
VNM
9
WLF
17
ESH
25
YEM
28
ZMB
24
ZWE
21
0
0 0 2 2 5 7 5 13 10 13 10 13 7 7 6 12 8 16 4 8 10 8 11 5 8 7 4 4 5 5 3 3 2 2 1 2 1 1 1 0 1 4
21

Note: the leading 0 and following 21 is the command to print results and result of the print result commands respectively (this explanation is as messy as the code). TL;DR, the solutions from 0,1,2,...39,40,OVER, are listed in the long number line.

As you can see from my beautifully crafted code, (I bet this'll make some programmers puke, I did it just to test my regex skills), the only 0's are for variables zero, one, and thirtynine, meaning these are the only ones that can't be represented by a country code. Zero and thirtynine correspond to nowhere and everywhere intuitively being none and every, and one is the loneliest number sitting at home. (basically from process of elimination)


Answer for Lock 2:

For the system to work, every number has to be able to be represented otherwise he needs another system when combinations include 0/1 etc. Also, there should be no reason to break the pattern of using country code abbreviations if he didn't have to, so all three should represent numbers that can't be made with country abbreviations. Assuming this link is used for codes, 2 can be made with RSR, and 3 can be made with OMN, (the rest have multiple), meaning there is none for 0 or 1. To associate these with nowhere and everywhere, I'd say 0 is nowhere and 1 is everywhere. Home could then be either actually home, or one other number that can't be made. I don't know if I should write some code to convert these to numbers though without confirmation.

$\endgroup$
  • $\begingroup$ @JLee finished it, although I wonder if it's acceptable xD $\endgroup$ – Quark Jul 10 '15 at 0:32
  • $\begingroup$ good job! maybe it would reach more people if you took out the code and results, and just stated the main find, which you already did, that those 3 were the only unrepresented numbers. most people will think this was a code puzzle, but it's not really. i used excel to calculate the distances with fairly simple formulas. $\endgroup$ – JLee Jul 10 '15 at 0:40
  • 1
    $\begingroup$ either way you'll get the 100 in 5 or so days. i kinda wish the site would let me give 50 to you and 50 to Cerberus, but it doesn't, so you will get all 100. $\endgroup$ – JLee Jul 10 '15 at 0:43
  • 1
    $\begingroup$ OK, if you feel that way. but my formula in excel was =ABS(CODE(MID(A1,1,1))-CODE(MID(A1,2,1)))+ABS(CODE(MID(A1,2,1))-CODE(MID(A1,3,1))), and I just dragged it down. It took 2 minutes in total. $\endgroup$ – JLee Jul 10 '15 at 1:18
  • 1
    $\begingroup$ Working 9 hours a day with Excel, I am one of those who thinks that sometimes it's much easier writing a couple of formulas than a page of C code! I think that this was a good example... ;) $\endgroup$ – Hunter Jul 10 '15 at 14:08
19
$\begingroup$

I think I found the answer:

You need to take the three-letter code of each country and calculate the 'distance' (d) between 2 consecutive letters, and finally add them.

Belgium --> Germany --> France

BEL --> DEU --> FRA
d(B,E) + d(E,L) = 3 + 7 = 10
d(D,E) + d(E,U) = 1 + 16 = 17
d(F,R) + d(R,A) = 12 + 17 = 29

Saudi Arabia --> Iran --> Qatar

SAU --> IRN --> QAT
d(S,A) + d(A,U) = 18 + 20 = 38
d(I,R) + d(R,N) = 9 + 4 = 13
d(Q,A) + d(A,T) = 16 + 19 = 35

That means that Brazil --> Chile --> Argentina

BRA --> CHL --> ARG
d(B,R) + d(R,A) = 16 + 17 = 33
d(C,H) + d(H,L) = 5 + 4 = 9
d(A,R) + d(R,G) = 17 + 11 = 28
so the code is 33-9-28

I guess then that Everywhere --> Nowhere --> Home

EVE --> NOW --> HOM
d(E,V) + d(V,E) = 17 + 17 = 34
d(N,O) + d(O,W) = 1 + 8 = 9
d(H,O) + d(O,M) = 7 + 2 = 9
so the code is 34-9-9

$\endgroup$
  • 1
    $\begingroup$ +1 Excellent! I thought that last bit of edited info would lead to a quick reply, and it did. You figured out the correct method, but not Lock #2. Keep thinking. $\endgroup$ – JLee Jul 8 '15 at 14:21
  • $\begingroup$ Well done indeed. I wonder what would Jeremy do if he ever has to open a store in the Vatican, though. $\endgroup$ – Aioros Jul 8 '15 at 14:25
  • 1
    $\begingroup$ Yep, but wouldn't that be a 40? $\endgroup$ – Aioros Jul 8 '15 at 14:40
  • $\begingroup$ @Aioros He will use modulus I guess $\endgroup$ – A.D. Jul 8 '15 at 15:02
  • $\begingroup$ Maybe the second lock's voyage is some other word than those he gave you? For instance, Universe -> Space -> Earth. $\endgroup$ – Engineer Toast Jul 8 '15 at 19:13
3
$\begingroup$

Novice Guest Attempt

For Lock #2,

39-0-4

Rationale

Everywhere: 39, the highest possible number

Nowhere: 0, the exact opposite of Everywhere (and using Cerberus' solution for Lock #1, I can't immediately see how a value of 0 is possible)

I treated Home as the original store, which used this code: BEL --> DEU --> FRA
I then shortened it to BDF, which has a value calculated by:
d(B,D) + d(D,F) = 2 + 2 = 4

$\endgroup$
  • $\begingroup$ on the right track! you've got a bit of it and frodoskywalker's question has a bit of it. $\endgroup$ – JLee Jul 9 '15 at 11:26
2
$\begingroup$

I've found something that may be on the right track, but I can't quite get it to work for the second lock. Note that since I got the following from wikipedia, there's a chance some of the numbers are wrong.

If we take the number of regions in each country in the first set and add n-1, where n is the position in the code, we get:

Belgium - 10 provinces (+0) = 10
Germany - 16 states (+1) = 17
France - 27 regions (+2) = 29

I'm not sure how to handle numbers over 39, however. If we assume we should mod by 40 (there being 40 possible digits to enter), we get:

Saudi Arabia - 118 amins (mods twice to 38) (+0) = 38
Iran - 324 shahreshtans (mods 8 times to 4) (+1) = 5
Qatar - 87 zones (mods twice to 7) (+2) = 9

$\endgroup$
  • $\begingroup$ Great ideas here, but, it's not the right track. The answer is not so complicated. Hint #2: It doesn't require mod and it doesn't require knowledge of provinces, states, zones, or regions. Tip: Ignore lock 2 at first, and when you have figured out a method, apply it to Lock #1. Then, apply a small amount of creative/lateral thinking to get lock #2. $\endgroup$ – JLee Jul 7 '15 at 15:10
  • $\begingroup$ Doesn't work for the second lock, and how can you possibly have any subdivisions for everywhere, nowhere and home? $\endgroup$ – CodeNewbie Jul 7 '15 at 15:10
  • $\begingroup$ Wow, it doesn't require mod? Very interesting... I think every single thing I'd tried so far had "mod 40" in it somewhere! $\endgroup$ – Curmudgeon Jul 7 '15 at 15:17
1
$\begingroup$

I wanted to add this as a comment, but it won't let me, so here goes: I give credit to Cerberus for getting the first part of the answer, and I think I've worked out the 2nd lock.

The answer is:

11-2-16, or 12-2-16.

The reasoning is:

For Everywhere, it could either be ALL or INF, for infinity.
This gives us:
d(A,L) + d(L,L) = 11 + 0 = 11;
d(I,N) + d(N,F) = 4 + 8 = 12;

For Nowhere, the code is NON, which is a version of NOT, or nowhere.
calculating the distance of adjacent letters, we get:
d(N,O) + d(n,O) = 1 + 1 = 2;

Home is "where the heart is", so the code is WHI.
Finally, we get:
d(W,H) + d(H,I) = 15 + 1 = 16;

$\endgroup$
  • $\begingroup$ Nice attempt, but no. Yes, lock #2 is more subjective than the other locks, but I don't think it's quite this much of a stretch. $\endgroup$ – JLee Jul 8 '15 at 19:41
  • $\begingroup$ @Jlee yeah, that's why I initially wanted to make it a comment. $\endgroup$ – Nyk 232 Jul 8 '15 at 19:43
1
$\begingroup$

I give credit to Cerberus for getting the first part of the answer, and I think I've worked out the 2nd lock. First part:

That means that Brazil --> Chile --> Argentina BRA --> CHL --> ARG ! d(B,R) + d(R,A) = 16 + 17 = 33 ! d(C,H) + d(H,L) = 5 + 4 = 9 ! d(A,R) + d(R,G) = 17 + 11 = 28 ! so the code is 33-9-28

Second Part:

The answer is:

33-24-13.

The reasoning is:

For Everywhere, EWH
This gives us:
d(E,W) + d(W,H) = 18 + 15 = 33;

For Nowhere, NWH
This gives us:
d(N,W) + d(W,H) = 9 + 15 = 24;

For Home, HME
This gives us:
d(H, M) + d(M, E) = 5 + 8 = 13;

The reasoning for my choices is:

Because a combination lock needs to go forward, then back then forward again, I chose the letters which go in one direction, then switch back down.

$\endgroup$
  • $\begingroup$ Good try, but no, that's not it. $\endgroup$ – JLee Jul 8 '15 at 22:13
1
$\begingroup$

I think the combination of the second lock would be

21-7-8

Following the logic that

Jeremy uses the phonetic sound to assign the short codes. So the codes are EVR, NOU and HOM. (From the first syllable of each word.)

Which gives US, d(E,V) + d(V,R) = 17 + 4 = 21

d(N,O) + d(O,U) = 1 + 6 = 7

d(H,O) + d(O,M) = 6 + 2 = 8

$\endgroup$
  • $\begingroup$ Good idea, but not what I had in mind. The answer is less logical and more practical, as in, if you were Jeremy, the solution solves one of the problems presented by his strategy. Also, congrats on 3100 rep pts in just 6 weeks. Quite an impressive rate! $\endgroup$ – JLee Jul 9 '15 at 0:58
1
$\begingroup$

Lock #2

Here's my guess:

Since Everywhere, Nowhere and Home doesn't seem like there is a 3 letter code associated with it, I just work out

The distances between each of the letters. It's a positive number for every pair of letters that move forward e.g. d(E,V) & negative number for every pair that move backwards (e.g. d(V,E))

For Everywhere, the numbers are

d(E,V) = 17
d(V,E) = -17
d(E,R) = 13
d(R,Y) = 7
d(Y,W) = -2
d(W,H) = -15
d(H,E) = -3
d(E,R) = 13
d(R,E) = -13

Add them all up = 0

For Nowhere, the numbers are

d(N,O) = 1
d(O,W) = 8
d(W,H) = -15
d(H,E) = 3
d(E,R) = 13
d(R,E) = -13

Add them all up = -9

For Home, the numbers are

d(H,O) = 7
d(O,M) = -2
d(M,E) = -8

Add them all up = -3

Then

39-0, 39-9, 39-3 = 0, 30, 36

Jeremy won't need to remember any 3 letters country code as long as he knows how to spell!

$\endgroup$
  • $\begingroup$ Good ideas, but not it. See my comment on CodeNewbie's post. $\endgroup$ – JLee Jul 9 '15 at 9:58

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.