You are given 80 eggs and given the following information
All the eggs except one are of identical weights. The exceptional egg is lighter.
Your goal is to find the exceptional egg that is lighter, and you can only use a weighing balance (each side may hold any number of eggs). What is the minimum number of weighings that is needed to guarantee to identify the egg?
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.
There is a standard information theoretic argument for the general case. Since at every step of weighing there are three possibilities of the outcome (equal, left-heavy and right-heavy), the required number of weighing would be at least k where 3 k ≥ 8 0 . Now the interesting problem is to show that this is achievable. See this for example.
Log in to reply
Hi Abhishek, you are excellent. Can you explain the logic how you arrived at this 3 power of K greater than or equal to 80? I couldn't figure it out :(
Log in to reply
If n is divisible by 3. For every measurement, you can eliminate 2n/3 eggs. So for every measurement, the search space becomes 1/3 times smaller. To reduce the search space to one egg, the operation needs to be done log(n) times with a base of 3
40&40 --- and take the lighter part and device them 20&20 --- take the lighter part and device them 10&10 --- take the lighter again 5&5 --- then Take 2&2 If equal then The last one is the egg required ... so (five steps) Else 1&1 and take the lighter ... so (six steps) ,,,
Log in to reply
U didn't understand the solution since it's explained badly in fact you divide the group to 3 parts not 2 . 2 on the scale and one with you if they match the light egg exist on the part on .the out side if not then u know where the light on . And continue until u have 3 eggs 2 on the scale and one with you
I did it the same way
I have a solution for this problem in 6 steps. But it is not the general case. But it still is the solution to this problem. Initially 80 eggs are divided into two sets of 40. After weighing both sets the one that is lighter will contain the lighter egg. The other set is eliminated. We now have 40 eggs. They are divided into two sets of 20 and weighed. The lighter set is eliminated. The process goes two more times. Now we have 5 eggs. Weigh the first two. If one is lighter it can be identified. Else eliminate both. Now we have three left. Weigh two more. If one of them is lighter that is the egg we are looking for. Else the final egg is the lighter one.
Log in to reply
Instead of wasting steps u could divide into 3 groups not 2 .... 2 on the scale and one with you.
Technically the minimum number of tries is 1 The maximum using optimal strategy is 4
If you think logically though you would only need one step and a whole lot of luck to find the right egg the first time.
Your task was to calculate the minimum number of moves. This number is two becuase you can randomly pick the one egg which is lighter and compare it with another so you found the lighter egg. A better task would be: how many moves do you need in minimum, to ALWAYS find the lighter egg
The thing with this question is it's not asking how many steps to 'guarantee' that you'll find the egg. It just asks how many it would take to find it. The correct answer to the question worded in the way it is would be 2. Weigh 39 eggs on each side, they're equal, weigh the remaining two. That is a viable option, and it is possible, however unlikely, to find the egg using that method. If you want to guarantee that you'll find the egg given multiple sets of 80 eggs and want to find the one in each as quickly as possible? Then yes, the answer would be 4. But in the way it's worded, the answer should only be 2. Whether I'm being too much of a smartass for logic questions, I don't know.
Log in to reply
I guess in this case minimum number is one. You put one in each pan. One is lighter and that is it.
How to divide if the number of eggs are lesser than 2*pow(3,r-1)?
Thats me in the pic with those eggs...i want to know who used that picture for the quiz...thats pretty cool.
Great solution bro... Well done....
Great observation used in it
Thanks @Snehal Shekatkar . Slight phrasing correction: // If they don't balance, then take remaining 26 eggs should be // If they do balance, then take remaining 26 eggs
No. If I take 2 in my hand, and split the 78 into 2, there's the possibility that they weigh the same so the special egg is in my hand. So the minimum needed is 2. The problem does not exclude this possibility !!!
Log in to reply
That was my solution as well. The question specifically states 'minimum amount of weighings'. If the 39 eggs on each side weigh the same it must be one of the two eggs in my hand. Weigh them and I know which egg it is. The answer should be 2.
You should have specified it's a beam balance! (Although if that was not the case, none of the answers would have been correct...)
Immediately rule out any answer choice that's 3 and below. I mean, yo, the table is like filled with eggs and stuff, 80 of them, and dang that's alot, and you be like, "You want ME to figure out which egg it is with THREE weightings? Aw hail nawww!" So yah, just imagine it for a sec, it AIN'T gonna happen.
So now we're down with 4 and 5. We either have to prove that A) 4 is not enough, or B) it can be done with 4.
But before we approach this problem, we need a strategy. Brute forcin is no man's land and so there's gotta be some nice logical concept of wonderfulness.
But yo, figuring out some awesome concept with a gazilllion eggs ain't gonna cut it. We gotta simplify things with lower numbers.
A princess, 17 rooms and only 30 days?? Simplify! 4 rooms and an infinite number of days and work your way up!
1000 bottles of wine? Can we just like, start with 3 bottles or somethin and see what we can do?
But sometimes, being simple doesn't cut it. 2 Levers and 50 prisoners? Not gonna do anythin! A chessboard, your friend and 64 randomly flipped coins? Eek.
But this balancin puzzle seems simple enough to use simplicity yo! Let's say there was like 1 egg, how would you-
Kay being too simply is bad. How about 2? Well duh, compare them once and dun...
How about 3? Well you have 3 eggs A, B, and C... Well, if you weigh like for example, AB against C, then that's completely useless! AB is of course greater! That lighter oddball egg must at least have SOME mass! If k > 0 then x+k > x!
...unless it has negative mass or something. Bleh.
So let's be a bit rational and weigh like, A with B. There are 3 things that can happen.
So if there are 3 eggs you can win with 1 weighting.
You can totally just solve the puzzle by going up 1 egg each time like this. As soon as you reach 9 eggs and solve, you basically figure out the pattern. But,,, what if A, B, and C were groups of eggs? That means... every time you weigh, you eliminate like an ENTIRE TWO THIRDS of those eggs as possibilities!
So let's say you have like, 9 eggs. Separate into groups of 3 eggs A, B, and C. (3 * 3 = 9, fyi) Weigh A and B. Let's say like, B was less than A. The oddball egg can't be in A or C! It gotta be in B.
So group B has 3 eggs, D, E, and F. And well, we know this can be done in 1 weighing.
So you can kinda notice some powers of 3 stuff going on. 1 eggs --> 0 weightings, 3 eggs --> 1, 9 eggs --> 2, 27 eggs --> 3, 81 eggs --> 4...
Hey wait, weren't there only 80 eggs?
80 isn't a power of 3, so we can't cut it into thirds. However, we can PRETEND that there is another egg. We split into 27, 27, 26 and weigh the 27s. If they are equal, borrow a normal egg from the first 2 groups and stuff it into the group with the abnormal egg! Now instead of some oddball number of eggs like 26, you have 27! Therefore, 80 eggs can be done in 4 weightings.
Your explanation is the most correct and best explained!👍👌
loved it.. :D . It is you only who has distinctly focussed on elimination of the Entire Two Third of A Lot... in each weigh. :) (y)
Here's my solution. 1)First take any 40 eggs and weigh them 20-20. If Isn't balanced then take the lighter 20s. 2)now take any 5-5 eggs of them and weigh them. If isn't balanced then taje the lighter 5s. 3)now weigh the 2-2 of the lighter 5s. If balanced, then the answer is the remaining egg. If isn't balanced weigh the lighter 2s. 4) after weighing 2s the lighter one is the answer.
What if the first weighing is equal? We only rule out 40 eggs, and we still have 40 to deal with. 3 weightings is not enough to deal with 40 eggs as opposed to 20.
Log in to reply
I know. But the question was " What is the minimum number of steps you need to identify the egg?". I assumed we were lucky enough to get the right set of eggs every time. :p
Log in to reply
Then I guess with the most outrageous luck, it can be done in one weighing no?
Log in to reply
@Bryan Hung – Most outrageous luck also includes 0 weighing.. As I am very very very lucky, the one I pick is the odd egg ;-)
@Bryan Hung – Actually 2 to know even in the best case scenario, which is what i said for this problem.
The question actually means "What is the minimum number of steps you need to identify the egg in the worst case scenario?". It is implied.
Awesome sir
Since we are lacking a practical one,
step (i)
We take 27 eggs each on the scales and weigh them.
If it doesn't balance, we have the lighter egg on that side, so we take those 27 eggs to step (ii)
If both sides balance, we take the remaining 26 eggs to step (ii)
step(ii)
We take 9 eggs each on the balance.
If it doesn't balance, we have the lighter egg on that side, so we take those 9 eggs to step (iii)
If both sides balance, we take the remaining 8 (i.e. 26 - 18) or 9 (i.e. 27 - 18) eggs as the case may be to step (iii)
step (iii)
We take 3 eggs each on the balance.
If it doesn't balance, we have the lighter egg on that side, so we take those 3 eggs to step (iv)
If both sides balance, we take the remaining 3 or 2 or 1 eggs as the case may be to step (iv)
step (iv)
We take 1 eggs each on the balance.
We find the stupid egg. :-)
out of the 40 eggs. what if the lightest weighing egg is balanced with the heaviest egg and the other side contains a combined weight lighter?
Log in to reply
We are only told to look for a light egg ==> all the other eggs have the same mass
Log in to reply
Technically the question does not specify directly that 79 eggs have the same mass, only that one egg has definitively less than any other egg. The way it is worded implies only that there is a definitive "lightest" egg. As it's worded, you would need to weigh one egg against one other egg and eliminate one at a time.
Now, obviously this is just for the fun of pointing out the technical wording of the question because the answers we are given as options imply the other 79 have the same mass....
But....technically correct is the best kind of correct, so...
Let us assume we know nothing about the eggs other than that there is 1 egg lighter than all others. We must then scale only 2 eggs at a time, separating lighter weights and setting aside any eggs that are heavier.
Since we know that one egg is lightest, if two eggs were to balance those can be eliminated based on the logic. Logically, if any eggs matched in weight it would reduce our steps as we could eliminate two eggs in one step, but we cannot assume this will be the case. Therefore our "minimum" amount of steps to find the egg every time will be in the scenario where we have 80 different weights.
In that scenario we must make 40 scales, setting aside 40 lighter eggs. Then 20 scales setting aside 20. Then 10 setting aside 10. Then 5.
We have now taken 75 steps, and have 5 eggs remaining. We can scale 2 more times to eliminate 2 eggs, 3 left. We can scale 1 more time to reduce to 2 eggs, then 1 final time to find the lightest egg.
79 steps. The way the question is worded, the minimum amount of steps needed to find the lightest of N eggs is N-1.
There is a flaw in the way the question is phrased, technically the minimum number of steps needed to identify the egg is one: Lucky pick of two eggs where one is the lighter one.
It should have been phrased as "given the optimal strategy what is the maximum number of steps needed to identify the egg."
I would say for good scientific practice one additional weighing (for a total of 2) to confirm results, and rule out any other variables. Agree on the wording being too vague.
Split into 40 and 40 then find side with lighter egg then split to 20 and 20 then find lighter side then split to 10 and 10 lighter side again. But this time split into 4 and 4 to avoid odd number if stable split the other 2 to 1 and 1 you will find the answer worst case senario it is step 4 is not stable then split into 2 and 2 find lighter egg then measure.
I simply categorized the 80 eggs into 2 groups then divide the one that was heavier and divided 3 more times to pin point which was heavier.
That would only get you down to 5 eggs.
I don't get why should we divide them to 27 + 27 Since we are talking about the minimum number, My solution is: 1- Divide them into two groups 40 +40 2- Divide the first 40 into 20 + 20 on the weigh scale (assume you got the lighter 20 from the first time (we are talking about a minimum number of trials) # 1st step 3- Divide the lighter 20 into 10 + 10, Identify the lighter 10 # 2nd Step 4- Divide the lighter 10 into 5+5. Identify the lighter 5 #3rd Step 5- Divide the 5 into 2 + 2 on the weigh scale and leave the last one aside, assume that they are identical and the left 1 is the lighter one # 4th Step
So The minimum number of weighing trials is 4 times.
4 is possible as many of the solutions here explain how but in order to prove that this is the minimum we have to prove that 3 is not enough. Can anyone prove that?
Problem Loading...
Note Loading...
Set Loading...
Note that if there is a lighter egg among 3 eggs then we need only 1 step to find out the lighter egg : we simply put any 2 of those 3 eggs on balance. If they balance perfectly then third egg is lighter, otherwise one which goes up is lighter. Now consider the case of 9 or less number of eggs. In this case, lighter egg could be found in 2 steps only. To do this, we keep 3 + 3 eggs on balance and repeat the procedure given above. Given this, we can find lighter egg in 3 steps if there are 2 7 of them by putting 9 + 9 on balance. Finally, for 8 0 eggs, we put 2 7 + 2 7 on balance. If they don't balance then pick those 2 7 which contain lighter egg. Then locating that egg would take 3 steps as explained above. If they do balance, then take remaining 2 6 eggs and divide them as 9 + 9 on balance and then its easy to see that this takes only 3 steps. Hence in total we need 4 steps to locate the lighter egg.
In general it takes r steps if the number of eggs is less than or equal to 3 r . This I discovered in collaboration with @Abhijit Bendre .