Pop quiz

QUESTION 2

You are given 10 bags with 1000 coins in each bag. 9 bags hold 1000 coins that weigh exactly 1g. The remaining bag holds somewhere between 990-999 coins weighing exactly 1g. You're a technician at a metrology lab and your boss is a hardass about very expensive balance time, so you are only allowed to make one weighing. You're not allowed to take any coins out of the bag or tamper with the bags in any way or you'll get fired for corporate theft. You are being monitored via CCTV as you work. How do you determine which bag is short on coins?

with approximately* 1000 coins in each bag

Let a Jew sniff them. See which he wrinkles his nose at.

Load up all the bags on the scale and remove one at a time

...

It prints I am a street shitting OOP niggermonkey

But I am, I'm just removing the weight very carefully sir :^)

Sounds like a shitty job. What do I get paid for this foolish errand?

1. Weigh 5 on either side, discard heaviest side
2. Weigh 2 on either side, if equal the fifth bag which you didn't way is the one you are looking for, else discard the heaviest side and continue.
3. Weigh the last to bags and discard the heaviest one. The bag that's left is the one you are looking for.
20% of the time it will take 2 operations, 80% of the time it will take 3 operations.

I'm lazy, but it probably wouldn't've been too hard to show that it will have an upper bound of ceil(log(n)) - 1 operations for n amount of total bags.

You split the group into 5 bags. You weigh one group, and select the half that didn’t sum up to 5000 grams. That gives you a 20% chance of randomly selecting a bag with missing coins.
Although that seems low, it is the fairest probability. For example if you weigh 9 bags, you would get 100% of the remaining bag being correct if the weight was 9000 grams. But if it wasn’t, you would have 11% of getting a bag right to choose from.