# Jellybean Riddle about differing mass

1. Jan 2, 2013

### Daaniyaal

There are 9 jars of jellybeans, 8 of these jars contain jelly beans with a mass 1 gram, one jar contains j beans with masses of 1.1 grams. The only tool available to you is an electronic gram measure, which melts after giving you one measurement. How do you find the jar with the jelly beans of differing mass?

2. Jan 2, 2013

### Staff: Mentor

Since you didn't specify that the beans weren't all of similar size and weight, simply pick them out and count them, it's a real easy way that requires no tools. Pour them into a water proof plastic bag and submerge them in water and see which one displaces more water.

3. Jan 2, 2013

### micromass

Pick 1 bean from the first jar, 2 beans from the second jar, 3 beans from the third jar, etc.

4. Jan 2, 2013

### Daaniyaal

Sorry, all of the beans are of the same volume and density, the only thing that differs is their mass.

5. Jan 2, 2013

You got it!

6. Jan 2, 2013

### Staff: Mentor

You may want to think it over.

7. Jan 2, 2013

### Staff: Mentor

He only got it because he has better reading comprehension than I do. And pays attention to details. Pffft.

8. Jan 2, 2013

### Daaniyaal

Yes. I completely agree with you Evo.

9. Jan 2, 2013

### Staff: Mentor

I completely misread what you wrote. Evo is getting careless. I was thinking total mass of the jar. <sigh> Micro pointed out it's a gram per bean, not a kg per jar.

Evo needs to realize when her brain ceases functioning for the day.

10. Jan 2, 2013

### Daaniyaal

Talking about oneself in the third person is rather magnificent, is it not?

11. Jan 2, 2013

### Staff: Mentor

My dog is very sick and on meds, her heart chambers are enlarged due to pulminary problems and it caused her bronchial tubes to become bowed. She's either gasping for air or coughing and hacking all night. I've only slept 7 hours the last three days and most of that was in 16 minute increments. I tried to change the tv by using my cell phone today and thought it was broken, no my cell doesn't control my tv.

I'm thrilled I got the fact that they were jelly beans.

12. Jan 2, 2013

### Drakkith

Staff Emeritus
How does that solve the problem?

13. Jan 2, 2013

### D H

Staff Emeritus
This solution assumes that this selection is possible. You're out of luck if all of the jars contain one bean, for example.

You're also out of luck if all of the jars contain 8 beans. One way around this is to pick 0 beans from jar #0, 1 from jar #1, 2 from jar #2, etc. It's essentially the same algorithm, but with a bit less counting.

Per micromass' solution, 45 beans are being weighed. If all of them were 1 gram beans, the total mass would be 45 grams. The total mass will exceed this by some amount because the beans from one of the jars have a mass of 1.1 grams each. Simply multiply the amount by which the total mass exceeds 45 grams by ten and viola! you have identified the jar that contains the overweight beans.

Last edited: Jan 2, 2013
14. Jan 2, 2013

### Drakkith

Staff Emeritus
I'm lost. Why do you even need to measure an increasing number of jellybeans?

Edit: Never mind, I figured it out...

15. Jan 2, 2013

### Jimmy Snyder

Jimmy had heard this one before.

16. Jan 2, 2013

### Daaniyaal

OH NO D: Poor doggy. Daaniyaal didn't mean nothing by it, he also enjoys speaking in the third person. Also, there is an app for that :P

17. Jan 2, 2013

### Daaniyaal

Jimmy is quite the riddle master.

18. Jan 2, 2013

### Staff: Mentor

I was the same, I knew I had seen the solution before but was still, what? WHAT??? Oh....

19. Jan 4, 2013

### BobG

If they have the same volume and density, then they have to have the same mass.

But.... if they have the same volume, but a different density (and mass)......

Why not just taste them?

If the jelly beans have the same volume and appear the same, but one has a different density, then those jelly beans must have been made with a different recipe - or perhaps the cook added salt instead of sugar, since salt has a higher density than sugar.

20. Jan 4, 2013

### BobG

This solution also assumes you know that only one jar has 'heavy' jelly beans. Assuming you have large jars with many jelly beans, how to tell which jar(s) have heavy jelly beans if you don't know how many jars have defective beans?

(This is the principal behind one type of forward error correction in satellite communications).

21. Feb 3, 2013

### BobG

This is also the principal behind the checksum in your VIN number. It's a "weighted checksum" (as opposed to a modulo sum, which won't catch two numbers transposed).

Interesting story about an acquaintance's daughter. She was pulled over for a minor traffic violation, but had her car show up on the computer as flagged for pick-up (confiscate the tags and have vehicle towed) due to a car insurance violation. Not only did they tow her car away, but they left her and her friend standing on the street corner to find their own way home.

Assuming the VIN number on both the registration and the proof of insurance card are the same (after all, doesn't every responsible vehicle owner double check those numbers?), it shouldn't matter which piece of paper the officer uses to run the vehicle check. Except in this case ......

Turns out the VIN number on her insurance policy (and her proof of insurance card) was wrong.

The VIN number on her insurance card was for a person that hadn't had vehicle insurance since the summer. And in some states, when your insurance is cancelled, your VIN number winds up on a special list. This prevents people from purchasing vehicle insurance, paying one month's premium to get the proof of insurance card necessary to register the vehicle, and then just blowing off any more payments until time to puchase new insurance the next year just prior to reregistering the vehicle.

And the acquaintance is shocked! She wonders what the chances are that the incorrect VIN number belonged to some other vehicle that just happened to be the exact same make, model, year, and even color as her daughter's car! (Even in "My Cousin Vinnie", it was a 1963 Pontiac Tempest that was just confused as a 1964 Pontiac Skylark, which is entirely understandable!)

Actually, pretty good, since quite a few of those characters specifically refer to the make, model, year, etc. In fact, only the last six characters are unique to any given vehicle (those are just incremented sequentially for each vehicle manufactured of a certain make, model, color, etc). If the error were in the last six characters, the insurance agent's computer would still pop up with the exact same model, make, year, etc, meaning surely he entered all of the data correctly (after all, what are chances that a random error would pop up as the exact same model, etc?)

Still, one of the characters in a VIN code is a checksum (and a weighted checksum at that). In fact, it's the 9th character (the very middle of the VIN number). And, sure enough, not only were the last two characters in the VIN number wrong, but the 9th character was wrong, as well.

Now that's a handy software enhancement. Some software would just give you an error message when the checksum came up incorrect. This particuar software the insurance agent used not only detected the checksum was wrong, but changed it to its correct value!

Well, uh... :uhh: .... that certainly seems like an enhancement ..... except doesn't that kind of defeat the purpose of the checksum?

Unless the insurance agent typed in 8 correct characters in a row, made an error on the 9th, and typed the next 6 correctly, before mistyping the last two. Or, the software disregards the checksum number completely and it's entirely up to the operator to compare the calculated checksum to the actual checksum, which is also possible, since the checksum character isn't included in the checksum calculation - it's just the result of the calculation.

Or, the software flashes the message, "The checksum for this VIN number is incorrect!", highlights the incorrect checksum number, and so the operator keeps plugging in different checksum values until he quits getting the message! Which, unfortunately, is also very possible! :rofl:

(It would probably be better to keep the user in the dark about which character was the checksum number, so only someone who actually understood checksums would be able to screw things up.)

Hard to know since I know nothing about the software the insurance company used. But, reliable error detection and correction (even when correction wouldn't be a good thing) is always an interesting problem.

But there is one bright spot. Since the error was obviously caused by the insurance company getting the VIN number wrong, at least they're reimbursing my acquaintance for the towing and impound fees, but, still .... what a bizarre mess! Where is Marissa Tomei when you need her?!

And, still, one wonders if the insurance company is so quick to accept responsibility because they figure, "What are the odds she gave them the wrong numbers over the phone and then have the exact make, model, year and color vehicle pop up on the screeen? Surely, the number was initially correct, right?" I wonder if they have any clue as to how this kind of error could happen? (I imagine their computer gurus could, but they probably don't handle customer relations.)

So, anyway, as to the jelly beans:

Take one bean from jar #1, two from jar #2, four from jar #3, 8 from jar #4, 16 from jar #5, 32 from jar #6, 64 from jar #7, 128 from jar #8, and 256 from jar #9.

Weigh the beans (of which there will 511 of them).

Convert the excess weight to binary and get a 9 bit binary number.

Each bit that has a one means that jar is heavy.

So, for example, if the mass were 518, which is an excess of 7 grams. There's only one possible combination that would give you an excess of 7 grams. That would be if jars 1, 2, and 3 were heavy. Jar 4 can't be heavy, because that would give you an excess of 8 grams.

An excess of 6 grams would mean jars 2 and 3 were heavy. Etc

Last edited: Feb 3, 2013