- Joined
- 25 February 2011
- Posts
- 5,689
- Reactions
- 1,233
It can be done in two complete trips. The first trip requires two switches flipped on and the lights noted. The light that isn't on belongs to the unflipped switch.
The second trip requires that one of the two flipped switches be unflipped.
The remaining light belongs to the flipped switch and the other light (that was previously on) belongs to the recently unflipped switch.
If you want to allow two trips, you can simply flick switch One, climb the stairs at your leisure, mark the light that is burning with a "1". Then go back down, repeat the same with switch Two and lamp "2". No need to test switch Three.
...
You could turn on two of the switches and allow the lights to warm up, then switch one off and run up the stairs like buggery before the one you had on cooled down.
You should now have one on, one hot and the one that hasn't been switched on would still be cold ???????
This is assuming that you are very fit you could do it in one trip.
cynic said:It'll be interesting to find out if the one trip approach works for those high efficiency globes that barely heat.
Yes, Boggo. That is the answer
The method a logician would use to find the highest number isYou can assume that being a brilliant logician he will use a method that maximises his chances of being correct.
Wan't this one done in November 2009? I have a very faint memory of wolframalpha being involved??
The method a logician would use to find the highest number is
- work out the probability of the location of the 2nd highest number
- turn over that many papers & remember the highest number found so far
- finally turn over more papers until he finds one higher & declares it the highest.
I didn't use any maths or probability theory to arrive at this figures. I generated 4000 bits of paper with a random number on it, and asked my PC to try the method 1,000,000 times.
My PC seemed to think that on average the 2nd highest number would be found somewhere in the first 18.7% of the bits of paper.
It doesn't matter what the highest number is (infinity isn't an issue) - the only thing that matters is that after around 18.7% of the bits of paper have been sighted he can expect to have seen the 2nd highest.
And therefore if any subsequent number seen that is higher is likely to be the highest.
And the 2nd part of the question is what is the probability he is right.....
My PC checked 1,000,000 times to see how many times the highest number of all the bits of paper was not in the 1st 18.7%.
If he uses this method, my PC reckons he has a probability of around 72.5% chance of getting it right.
You are on the right track, but I see some errors already.
My PC seemed to think that on average the 2nd highest number would be found somewhere in the first 18.7% of the bits of paper.
Try a Mac instead. Surely basic probability would indicate that the on average the 2nd highest number would be found somewhere in the first 50%?
He should turn over a sample set of 37% of the papers & note the highest number.
There is then (coincidentally) a 37% chance that the next paper he turns over that has a higher number on it will be the highest in the whole set.
By using a sample size of 37% of the papers, this balances the probability of actual highest number NOT being in that sample & also that the sample contains a sufficiently high number (not necessarily the 2nd highest) to exclude all but the highest in the remainder
And additionally the probability of any numbers higher than the highest in the sample set, but not the actual highest that are (fortunately) NOT turned over from the remaining papers.
However, still using brute force & a PC....
After looking at that article, I'm pretty sure that 1/e is an approximation. The optimal ratio will approach 1/e as n (the total number of papers) approaches infinity....As I mentioned, the optimum ratio is 1/e and the math to work that out is beyond me. But I have discovered that this problem is on Wikipedia (called the Secretary Problem) and all is explained there for those interested.
http://en.wikipedia.org/wiki/Secretary_problem
Yes, I remember posting it before, but I don't recall where or if it was on ASF. I have yet to find the full solution other than approximations, so I was hoping some new minds working on it might prove fruitful.
People seem to be now on the right track, so I will give the solution as best as I can. brty was close to the mark when he/she posted "By waiting until the first 500 numbers have been drawn,and then putting your name to the first number that is higher than any in the first 500, should give a probability of 1 in 4 of being correct" That is the strategy, but the number to pass over is not the optimum. 2020 was closer when he/she said " my gut feel is that it is about the 33% mark, that you turn up 333 of them, then continue until (as others have said) you get a bigger number than all the numbers to date = the biggest in the upturned pack".
As I mentioned at the very beginning you can get an approximate answer with very basic probability theory, but to get the exact answer requires a better knowledge of maths than I have. In fact my maths has improved enormously over the last day or so when I started using the Wolfram Alpha computational engine, but more about that below.
If you don't want to get deeply into the maths, you can derive the optimum fraction to use by evaluating for easy fractions like 1/5, 1/4, 1/3, 1/2 etc. and seeing which if these gives the greatest chance of being right. If you do this, you will find that 1/3 gives the greatest chance. Later I will show how to work out the optimum fraction using more advanced mathematics.
So your strategy is to answer No to the first 333 numbers generated (noting the highest number among these) and then say Yes to the first number (if any) that is higher than this. This will give you the greatest chance of success. This is how you work out the probability of being right....
This strategy will give you the correct answer if the 2nd highest number is in the first third (1/3 chance) AND the highest number is not in the first third (2/3 chance). Thus you will be correct 2/9 or 22% of the time (at least).
But it will also give you the correct answer if the 3rd highest number is in the first third (1/3 chance) AND the highest and second highest numbers are not in the first third (2/3 X 2/3 chance) AND the highest number comes up before the second highest number (1/2 chance). This comes to 2/27 or 0.074 or 7.4%. Since this is a mutually exclusive result to the first, both are potential outcomes, so the chances of either happening are 29.4%.
You would also be successful if the 4th highest number is in the first third (1/3) AND the first, second and third highest are not in the first third (2/3 X 2/3 X2/3) AND the highest number is generated before the second or third highest (1/3). This is 8/243 or .033 or 3.3%. Again, as this is a mutually exclusive result, the chances of any one of these three outcomes occurring, which would give the correct result, are now up to 32.7%.
So this is almost a one in three chance, but it will increase slightly more each time you evaluate and include additional possible successful outcomes. The 667th term will be the highest you can go and this will be when the 667th highest number is in the first third AND all 666 higher numbers are not in the first 1/3 AND the highest number comes before the other 665. However, evaluating beyond a few terms is pointless, as each additional term adds proportionally less and less to the final result.
So as an approximation, the chances of success using this strategy is about 1 in 3.
Now for the heavy stuff. If any of you are not aware of the computational engine Wolfram Alpha, I urge you to go to the website http://www.wolframalpha.com/ and play around with it. It will blow your mind when you see its capabilities. There is an introductory video there that is worth watching. I will be using that website in this section.
In the advanced solution instead of using 1/3 as the fraction to turn, you need to first determine what actual fraction will yield the highest chances of success. 1/3 is close, but not the optimum fraction.
Lets say this fraction is n, where n is between 0 and 1.
So following the above basic probability logic, using the same strategy, but this time using n rather than 1/3, we get:
This strategy will give you the correct answer if the 2nd highest number is in the first n of the generated numbers (n chance) AND the highest number is not in the first n of the generated numbers (1-n chance). Thus your chance of success is n(1-n) at least.
But it will also give you the correct answer if the 3rd highest number is in the first n of the generated numbers (n chance) AND the highest and second highest numbers are not in the first n of the generated numbers ((1-n)(1-n)) AND the highest number comes up before the second highest number (1/2). The chance of this happening is 1/2*n*(1-n)^2. Since this is a mutually exclusive result to the first, both are potential outcomes, so the chances of either happening are n(1-n) + 1/2*n*(1-n)^2.
You would also be successful if the 4th highest number is in the first n of the generated numbers (n chance) AND the first, second and third highest are not in the first n of the generated numbers ((1-n)(1-n)(1-n)) AND the highest number is generated before the second or third highest (1/3). This is 1/3*n*(1-n)^3. Again, as this is a mutually exclusive result, the chances of any one of these three outcomes occurring, each of which would each give the correct result, are now n(1-n) + 1/2*n*(1-n)^2 + 1/3*n*(1-n)^3.
This can be continued on by evaluating for the 5th and subsequent highest numbers in a similar fashion, increasing the accuracy of your answer each time. It should be apparent that including the (x+1)th highest number in the evaluation will add 1/x*n*(1-n)^x to the result for your chances of success. As the highest term you can evaluate to is the 1000*(1-n)th highest number, the complete formula for the probability of success is:
sum of 1/x*n*(1-n)^x for x =1 to 1000*(1-n)
So what we want to now do is find what value of n gives the highest value to that formula.
The days when I could work that out are long behind me, but we can use Wolfram Alpha to help us.
Remember each additional term adds proportionally less and less to the accuracy of the answer so lets try firstly just for three terms (e.g. that the 4th highest number is in the first n etc. as described above). So we want Wolfram Alpha to evaluate this formula
global maximum sum(1/x*n*(1-n)^x) for x = 1 to 3
So copy this line in its entirety (including the words global maximum) and paste it into the search field at www.wolframalpha.com and then hit enter or press the = sign. Wait a few seconds for the results to be calculated. There will be a section called Global Maximum. If it shows "approximate form" at the top right of that section, click on that term and it should show "exact form" You will get the formula expanded out into individual terms and then to the right of it, it shows:
0.341572 at n~~0.422862
What that is saying is that formula is at its maximum when n is approximately 0.422862 and it evaluates to 0.341572 when n has that value. In other words, if we calculate to just 3 terms, the optimum number of random numbers to let pass is 422 (instead of 333 using the 1/3 approach), and the chance of success will be 34%.
Now lets make Wolfram Alpha really work and change the 3 in the formula to 199 so it reads "for x = 1 to 199". So we are trying to get really accurate by evaluating to 199 terms. The result under global maximum is so big, you will need to scroll down to see the result which this time shows:
0.367879 at n~~0.367861
If you try to go higher than 199, Wolfram Alpha usually gives up, so this is as close to the optimum as we can get using that tool. In fact the optimum would be only ever so slightly different and would be:
0.367879 at n~~0.367879
Both the optimum fraction to use to maximise the chances of success and the probability of success at that optimum value are the same.
For those of you still awake, this fraction just happens to be 1/e, e being the natural number e. Now, ain't that interesting.
So what the final result is saying is that to maximise the chance of success, say No to the first 367 numbers (but note the highest of them). Then answer Yes to the first number that is higher than the number noted. If you follow that strategy, your chance of identifying the highest number overall (of the 1000 generated) is 36.7%.
16th November 2009 you wrote this in ASF (took me a while to find it )
The Random Number Generator - One of the best Maths problems ever IMO
*whew* for a second there I thought my memory was going !!
What thread was that? I thought I might have posted it on ASF before, but the only puzzle thread I could find was this one and it wasn't here.
Seeing the answer is fully explained in Wiki, it will be hard to post any of the classic puzzles without someone being able to look up the answer. You would certainly have to call them by a different name to what the original was called and change the narrative a bit.
Your postings to this thread have attracted much interest from some of the logically and mathematically inclined members of this forum.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?