Jump to content
BrainDen.com - Brain Teasers
  • 0


Guest
 Share

Question

ok so this problem doesnt quite fit a normal number lock,but hey its close

There are 4 locks you need to crack that each are just one number you need to guess. The locks only use the numbers 1-5. Of course this problem would be definitely solved in 20 quick guesses except for the fact that the MAN found out your breaking in and has randomized the lock in order to try to stall you long enough for the police to arrive. Everytime you guess at a lock you either get it right and it opens or it randomizes again (still from one to 5).

Three questions the first two are pretty easy, the third one is pretty hard I know the answer but Im having trouble proving it.

1. what is the average tries to break the locks

2. You get to the next door and the locking mechanism is the same except... The last two locks have to be opened in a row (if you get lock 3 right you have to get lock 4 right next guess or lock 3 relocks). What is the average now?

3. You get to the next and final door. Millions of dollars in the next room, but this is the hardest lock yet. Its still randomized, but now if you get 4 wrong in a row one of the locks you've already done relocks (if none are unlocked yet nothing happens). locks only lock every 4 youve missed in a row, the 5th or whatever miss doesn't make one lock. Now what is the average?

I hope ive described this aptly but feel free to ask questions.

Link to comment
Share on other sites

20 answers to this question

Recommended Posts

  • 0

Is the initial lock numbers of the four locks same ,or different ,or is it that we don't know about it at all?

if the locks don't necessarily have same/all diferent initial code... then,... I think, if you try to unlock a lock and if you fail, then it randomize again. So, I don't see how you could be ever be sure to unlock it in any finite no. of tries. You may try to unlock it for infinitly many times, yet come out to be unlucky each time. Since, you have put your question so long and confident, I must be taking some wrong assumption, is it?

Link to comment
Share on other sites

  • 0

1) It is about 3 for each lock so 12 for all 4. It comes out to 48.8% of a chance so I just rounded off.

2) The first two would be the same so 6 tries for the other two it will take a total of 18 tries each. So a total of 42 tries for all four locks. The original percentage is 4% chance to get both right on any given try and at 18 tries it comes out to about 50% chance of getting it right.

I don't have time to work on the last one but I will look at it more when I get home. Good luck to everyone else on it.

Link to comment
Share on other sites

  • 0

im not gonna tell people if their right or not yet but as for the question The 4 locks are separate but identical entities. They can be the same number as another lock or all different and your right you cannot be assured of ever getting it, but your looking at the average for example it is highly unlikely that you get it in 4 tries and it is also unlikely that it take 100, they are two extreme points(tho not the extremist if thats a word). We are look for an average or an estimate(does no have to be a whole number or an actual possible outcome i.e. 7.23).

Also i forgot to mention in the last room is a prisoner. You can say two words to him and he has to know what the last combination was from those two words (cant be numbers). If he doesnt get it everyone in the whole world will be shot. (this is a joke, a bad one but that doesnt change the fact that i chuckled while writing it.)

Link to comment
Share on other sites

  • 0
im not gonna tell people if their right or not yet but as for the question The 4 locks are separate but identical entities. They can be the same number as another lock or all different and your right you cannot be assured of ever getting it, but your looking at the average for example it is highly unlikely that you get it in 4 tries and it is also unlikely that it take 100, they are two extreme points(tho not the extremist if thats a word). We are look for an average or an estimate(does no have to be a whole number or an actual possible outcome i.e. 7.23).

Also i forgot to mention in the last room is a prisoner. You can say two words to him and he has to know what the last combination was from those two words (cant be numbers). If he doesnt get it everyone in the whole world will be shot. (this is a joke, a bad one but that doesnt change the fact that i chuckled while writing it.)

But who will shoot the last person?!

Link to comment
Share on other sites

  • 0
ok so this problem doesnt quite fit a normal number lock,but hey its close

There are 4 locks you need to crack that each are just one number you need to guess. The locks only use the numbers 1-5. Of course this problem would be definitely solved in 20 quick guesses except for the fact that the MAN found out your breaking in and has randomized the lock in order to try to stall you long enough for the police to arrive. Everytime you guess at a lock you either get it right and it opens or it randomizes again (still from one to 5).

Three questions the first two are pretty easy, the third one is pretty hard I know the answer but Im having trouble proving it.

1. what is the average tries to break the locks

2. You get to the next door and the locking mechanism is the same except... The last two locks have to be opened in a row (if you get lock 3 right you have to get lock 4 right next guess or lock 3 relocks). What is the average now?

3. You get to the next and final door. Millions of dollars in the next room, but this is the hardest lock yet. Its still randomized, but now if you get 4 wrong in a row one of the locks you've already done relocks (if none are unlocked yet nothing happens). locks only lock every 4 youve missed in a row, the 5th or whatever miss doesn't make one lock. Now what is the average?

I hope ive described this aptly but feel free to ask questions.

Im not sure

error created editied last in quick edit

code because im not sure

Edited by 1234
Link to comment
Share on other sites

  • 0
im not gonna tell people if their right or not yet but as for the question The 4 locks are separate but identical entities. They can be the same number as another lock or all different and your right you cannot be assured of ever getting it, but your looking at the average for example it is highly unlikely that you get it in 4 tries and it is also unlikely that it take 100, they are two extreme points(tho not the extremist if thats a word). We are look for an average or an estimate(does no have to be a whole number or an actual possible outcome i.e. 7.23).

Also i forgot to mention in the last room is a prisoner. You can say two words to him and he has to know what the last combination was from those two words (cant be numbers). If he doesnt get it everyone in the whole world will be shot. (this is a joke, a bad one but that doesnt change the fact that i chuckled while writing it.)

5^4 means that are 625 possible combinations. To convey those to the prisoner in two words, simply assign those 625 combinations to 2-alphabet-letter combinations. Since there are 26 letters in the alphabet, we should be okay.

Link to comment
Share on other sites

  • 0

ok these are some good tries so far and i can see the logic behind all of them but for those not very into probability

the average that i am looking for is called a mathematical expectance which equals the sum of the probability of each events times its given value (in this case number in it) now this is sometimes easy and sometimes hard you can simplify this one by realizeing that each event is completely independent and identical so you can find the expectation for doing one and *4 so here it is

the mathematical expectation is

you have 1/5 *1 or winning immediately

4/5*1/5*2 or missing once

1/5*4/5*4/5*3 or missing twice and it continues in this fashion and surprise surprise there is a mathematical trick to solve this summation from 0 to infinity so

(infinity>x>0)summation(1/5((x+1)(4/5)^x

so 1/5( 1 + 4/5 *2+4/5*4/5*3+....) now heres a lil trick multiply by 1-4/5 (u'll see y)

you get (ignore the 1/5 for now well multiply by it later)

1-4/5 +4/5*2-4/5*4/5*2+4/5*4/5*3-4/5*4/5*4/5*3=1+4/5+4/5*4/5+4/5*4/5*4/5+... do it again

1-4/5+4/5-4/5*4/5+4/5*4/5+....=1 so your original equation times 1-4/5 twice =1 so your original equation =1/(1-4/5)/(1-4/5)=25

and bring back that 1/5 we left out at the beginning and you equation =5

now 4 switches 5*4 =20

now if you understood any of that do the second one but remember the last two are no longer independent

)

ok for the first question logically you dont say well he'll flip the switch 1/5 times so 2.5 is the average. thats like saying i flip a coin and get heads 1/2 the time so its going to take an average of one flip. Its just not true. it will obviously take 2 (on average). Same logic applies hear in a single trial that each try is independent of previous ones (probability of success does not change based on any other try) success average = 1/probability

now bushindo your answer i think is if the number of locks needed to unlock increased on 4 missed regardless if there was one unlocked. the real average of this im pretty sure is quite lower. Im sure you could prove me wrong tho. Also Ive forgoten how to set up that matrix equation (or i never knew i think i remember it tho) if you could explain it quickly please do so if its hard tho you dont have to bother

Edited by final
Link to comment
Share on other sites

  • 0

also good job on the first one psychic but i think your a lil wrong on the second one. I think if you take another look at your math youll see your logic mistake.

ill probably post the second answer after I eat dinner (so in the next 2 hours)

Link to comment
Share on other sites

  • 0

i hate the edit function it once again wont let me edit a post anyway heres the edit

also good job on the first one psychic but i think your a lil wrong on the second one. I think if you take another look at your math youll see your logic mistake.

ill probably post the second answer after I eat dinner (so in the next 2 hours)

sorry bushindo just saw your second post my b...

i was so looking forward to telling you you were wrong but i waited too long.... oh well

id still like you to explain the matrix..

Link to comment
Share on other sites

  • 0
ok these are some good tries so far and i can see the logic behind all of them but for those not very into probability

the average that i am looking for is called a mathematical expectance which equals the sum of the probability of each events times its given value (in this case number in it) now this is sometimes easy and sometimes hard you can simplify this one by realizeing that each event is completely independent and identical so you can find the expectation for doing one and *4 so here it is

the mathematical expectation is

you have 1/5 *1 or winning immediately

4/5*1/5*2 or missing once

1/5*4/5*4/5*3 or missing twice and it continues in this fashion and surprise surprise there is a mathematical trick to solve this summation from 0 to infinity so

(infinity>x>0)summation(1/5((x+1)(4/5)^x

so 1/5( 1 + 4/5 *2+4/5*4/5*3+....) now heres a lil trick multiply by 1-4/5 (u'll see y)

you get (ignore the 1/5 for now well multiply by it later)

1-4/5 +4/5*2-4/5*4/5*2+4/5*4/5*3-4/5*4/5*4/5*3=1+4/5+4/5*4/5+4/5*4/5*4/5+... do it again

1-4/5+4/5-4/5*4/5+4/5*4/5+....=1 so your original equation times 1-4/5 2 =1 so your original equation =1/(1-4/5)/(1-4/5)=25

and bring back that 1/5 we left out at the beginning and you equation =5

now 4 switches 5*4 =20

now if you understood any of that do the second one but remember the last two are no longer independent

)

look at the first question logically you dont say well he'll flip the switch 1/5 times so 1/2.5 is the average. thats like saying i flip a coin and get heads 1/2 the time its going to take an average of one flip. Its just not true. it will obviously take 2 (on average). Same logic applies hear in a single trial that each try is independent of previous ones (probability of success does not change based on any other try) success average = 1/probability

now bushindo your answer i think is if the number of locks needed to unlock increased on 4 missed regardless if there was one unlocked the real average of that im pretty sure is quite lower. Im sure you could prove me wrong tho. Also Ive forgoten how to set up that matrix equation (or i never knew i think i remember it tho) if you could explain it quickly;y please do so if its hard tho you dont have to bother

Sure thing

First of all, this problem uses the geometric distribution, which is the distribution for the probability of the first success. Assume that the four locks are arranged in a sequence from 1-4. Let's say we start at lock 1 and go left to right. If you successfully find the code in 4 tries or less for that lock, we get to move on to the next lock to the right. If we don't find the code in 4 tries (4 failures), we go back to the lock immediately before, except if we are already at lock 1, in which case we stay put.

Starting at any fresh lock, the chance of us finding the code in 4 tries or less (and thus moving on to the next lock ) is 0.5904. Given that we successfully find the code for a fresh lock, the average number of tries is 2.224932. The chance of failing 4 times and moving back once is (1-0.5904) = 0.4096 = .8^4. Given that we fail, the average number of tries is of course 4.

Okay, so let A be the number of average tries it takes to win the game, given that we start from lock i. The solution to this puzzle is of course A[1], the number of tries it takes to open the door if we start at lock 1. Lets consider the average number of tries it takes to open the door if we are on the last lock, lock 4. In that case, the average number of tries is equal to the chance of moving forward times the average number of tries given that situation ( 0.5904*( 2.224932 ) ) plus the chance of moving backward once times 4 plus the average number of tries if we start from the third lock [ 0.4096*( 4 + A[3] ) ]

We can write a system of equations like below

A[4] = 0.4096*( 4 + A[3] ) + 0.5904*( 2.224932 )

A[3] = 0.4096*( 4 + A[2] ) + 0.5904*( 2.224932 + A[4] )

A[2] = 0.4096*( 4 + A[1] ) + 0.5904*( 2.224932 + A[3] )

A[1] = 0.4096*( 4 + A[1] ) + 0.5904*( 2.224932 + A[2] )

Note that the fact that we stay put on lock 1 if we fail 4 times is already accounted for in the last equation. You can partition this into a matrix equation Ax = b, and solve for the vector ( A[1], A[2], A[3], A[4] ). Solving by substitution also works. A cleaner way to rewrite the above system is

A[ 5 ] = 0

A[ 0 ] = A[1]

A[ j ] = 0.4096*( 4 + A[ j -1 ] ) + 0.5904*( 2.224932+ A[ j + 1 ] ) for j between 1 and 4.

The above allows you to estimate the solution iteratively. The solution ( A[1], A[2], A[3], A[4] ), in case someone is interested, is

(36.88922, 31.88922, 23.42039, 12.54499)

Link to comment
Share on other sites

  • 0

i solved three, three different ways mostly by brute force but the most interesting one i thought was this (i think this works) you will need to try average of 20 times without negative movement. then on average you will lose 4^4/5^4 *20 so you need to get that back and during that you will lose an average of 4^4/5^4*20*4^4/5^4. then you need to gain that back and so on and so forth. This gives you roughly 34 i also wrote a program to do a simulation 100000 times and the average was 36.888 so your estimation was pretty darn good.

second puzzle left nobodies got it yet, treat it as 2 independent trials then a third independent trial with two dependent in it. Meaning solve for 2 in a row first. the way i did the math for 1 i didnt use for this one. I think its possible but logic is much easier in these cases

Link to comment
Share on other sites

  • 0

second puzzle left nobodies got it yet, treat it as 2 independent trials then a third independent trial with two dependent in it. Meaning solve for 2 in a row first. the way i did the math for 1 i didnt use for this one. I think its possible but logic is much easier in these cases

i solved three, three different ways mostly by brute force but the most interesting one i thought was this (i think this works) you will need to try average of 20 times without negative movement. then on average you will lose 4^4/5^4 *20 so you need to get that back and during that you will lose an average of 4^4/5^4*20*4^4/5^4. then you need to gain that back and so on and so forth. This gives you roughly 34 i also wrote a program to do a simulation 100000 times and the average was 36.888 so your estimation was pretty darn good.

1 is a repeat experiment of the geometric distribution. It is the distribution of the times to the first success for a repeat binomial trial.

http://en.wikipedia.org/wiki/Geometric_distribution

Problem 2 is a subcase of problem 3, where you move back 1 lock if you fail 4 times in a row. In problem 2, you have a smaller cycle where if you are on lock 4, you move back to lock 3 if you fail on the first try ( 80% chance). The number to average tries needed to move forward from lock 3 to lock 4 can be found using the method in problem 1.

Edited by bushindo
Link to comment
Share on other sites

  • 0

yah i realize the second one even tho its more logicallu solvable is pretty much the same thing i meant to do that for levels of hardness in 1 2 3 but i couldnt think of a way to directly solve the third one that recursionish formula or array thing helped alot.

also i was just going to logically explain 1 when i pulled that math formula to number one out of my ***. No one probably understood the explanation but i was proud of myself and thats all that matters. Anyway thanx for figuring out my problem for me i hate when i cant logically solve something and even my computer for loops math was off it was really bothering me. If it wasnt for the simulation i wouldnt have posted it because i wouldn't have had the answer and then i would have looked like the idiot when you said 64 at first i just would have assumed you were right and looked like a puts. anyway to the next problem.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...