frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

Sixteen bottles of wine riddle

https://chriskw.xyz/2025/08/11/Wine/
38•chriskw•3d ago

Comments

jeffwass•4h ago
> You briefly wonder how she managed to procure wine from over 2000 years ago before recalling that the wine cellar was built deep inside of a hypothetical scenario.

Lol

anArbitraryOne•3h ago
Yeah, imagine if hypothetical scenarios didn't exist…then what?
fainpul•2h ago
Could just label the years 2000 - 2015. It just says "sixteen possible years", not where these years are on the timeline.
alkyon•4h ago
I wasn't familiar with 'Poison and Rat' puzzle that the post mentions as an inspiration of the title riddle.

Without looking at the answer I came up with a geometric interpretation of it (explained below as this is a spoiler to the Poison and Rat puzzle).

alkyon•4h ago
Obviously 1000 rats is a wrong solution, you could remove one and still get the answer. But we could get better than that when you think about a thousand as three dimensional cube (10^3). Treating a rat with just one layer of the cube we could optimize to 30 rats. At this point I looked the answer they suggested and it was 10 (binary representation). Obviously one can construct a mulitdimensional cube with just two as a base - 2^10 and then its 20 rats. But know I realized I forgot the very first optimization I mentioned here that you could just use 1000-1 rat in the first place. So it will be fine with just (2-1)x10 rats (and 30-3=27 rats in the case of plain 3-dimensional cube).
anArbitraryOne•3h ago
How about this (choices are random): 1) Choose two bottles and one device 2) Measure the two. If they're the same, choose another device, if they're different, choose another bottle When bottles appear identical, make more measurements with different detectors on them (there's no way around doing that) When a device has accumulated n/2 0 or 1 measurements, the remainder are the opposite number (call this column constraint as per your table) When selecting the next detector, prefer the one that is closest to meeting the column constraint (otherwise choose randomly)

Sorry about the poor formatting of the algorithm but I'm typing on my phone and don't want to submit something AI generated

I was trying to figure out the runtime of this…it captures your best case scenario, and I think the worst as well, but what about the average?

gcanyon•2h ago

   The wines are from different years
   If you apply an arbitrary order to the bottles, the number of possible year-arrangements of the bottles is 16!
   Each test gives you one bit of information
   Since 2^50 is only greater than 16! by about 50x < 2^6, you only have about 5 tests to spare.
   There's probably some clever way to express the solution beyond just the brute force the above implies, but I haven't thought about it past this point
AcerbicZero•1h ago
Too easy. You just mix all 16 together, chuck them into the machine, take cover, then walk out through the now exploded door/hole.

Bonus points if you convince her to leave, and rig it up right above the door for when she comes back, home alone style.

tetris11•22m ago
couldnt you link the devices together in parallel, call your captor into the room under pretense of solving the riddle, and then shock them with your cowboy stun gun?
rmunn•1h ago
I found the bits-of-entropy analysis hard to follow, so here's how I explained the solution to my wife (who's not a programmer).

SPOILERS FOLLOW as I will be discussing the answer.

Looking at the table, device 3 obviously tells you if the bottle is from the "high" group (8-15) or the "low" group (0-7). So you line up the bottles and start using device 3 on them, and move them into two groups, 0-7 on the left and 8-15 on the right, as you get the results of each test.

Also, once you've found all eight bottles of one group, you can stop testing because all the remaining bottles will be in the other group. If you're lucky this might happen as soon as test 8, but worst case you must test 15 bottles, then you'll know which group the 16th belongs to without needing to check it.

Worst case: 15 tests done so far.

Now look at what device 2 does. For each group, 0-7 and 8-15, it tells you whether that bottle belongs to the "low" half of the group (0-3 or 8-11) or the "high" half of the group (4-7 or 12-15). Furthermore, in each group of eight, once you've identified four "highs" or four "lows" you can skip testing the rest. Worst case, you have to test 7 bottles of each group before you find four of a kind, and can skip at most 1 bottle per group. 2 skips total, 14 tests.

Worst case: 15+14 = 29 tests done so far.

Now you have four groups, 0-3, 4-7, 8-11, 12-15. You use device 2 which will tell you whether each bottle is in the "high" or "low" pair for each group (0-1 or 2-3, 4-5 or 6-7, and so on). Worst case you have to test three bottles from each group before you are guaranteed to find a pair and be able to skip the fourth bottle. So worst case here is 12 tests.

Worst case: 15+14+12 = 41 tests done so far.

Now you have eight pairs that are 0-1, 2-3, 4-5 and so on. The final device, device 0, will tell you whether the bottle you tested is the "low" or "high" bottle of that pair, so you can arrange each pair in correctly-sorted order after testing one bottle. Guaranteed to need 8 tests, with no possibility of luck of the draw changing that number.

Worst case: 15+14+12+8 = 49 tests done and you've arranged the bottles in order from 0 to 15, so you now know the year of every bottle.

chrisshroba•8m ago
I love riddles like this.

Has anyone found any good collections of these? Whenever I try to search for riddles online, I end up with mostly results containing wordplay riddles like "what has a mouth but doesn't eat, ..."

AWS CEO says using AI to replace junior staff is 'Dumbest thing I've ever heard'

https://www.theregister.com/2025/08/21/aws_ceo_entry_level_jobs_opinion/
639•JustExAWS•2h ago•233 comments

Apple Watch wearable foundation model

https://arxiv.org/abs/2507.00191
31•brandonb•1h ago•4 comments

How Well Does the Money Laundering Control System Work?

https://www.journals.uchicago.edu/doi/10.1086/735665
92•PaulHoule•2h ago•65 comments

Weaponizing image scaling against production AI systems

https://blog.trailofbits.com/2025/08/21/weaponizing-image-scaling-against-production-ai-systems/
129•tatersolid•3h ago•32 comments

Using Podman, Compose and BuildKit

https://emersion.fr/blog/2025/using-podman-compose-and-buildkit/
149•LaSombra•4h ago•31 comments

Launch HN: Skope (YC S25) – Outcome-based pricing for software products

8•benjsm•34m ago•1 comments

D4d4

https://www.nmichaels.org/musings/d4d4/d4d4/
344•csense•4d ago•41 comments

Show HN: ChartDB Cloud – Visualize and Share Database Diagrams

https://app.chartdb.io
37•Jonathanfishner•2h ago•7 comments

Show HN: OS X Mavericks Forever

https://mavericksforever.com/
157•Wowfunhappy•2d ago•46 comments

Mark Zuckerberg freezes AI hiring amid bubble fears

https://www.telegraph.co.uk/business/2025/08/21/zuckerberg-freezes-ai-hiring-amid-bubble-fears/
347•pera•4h ago•357 comments

Show HN: Using Common Lisp from Inside the Browser

https://turtleware.eu/posts/Using-Common-Lisp-from-inside-the-Browser.html
42•jackdaniel•3h ago•7 comments

You Should Add Debug Views to Your DB

https://chrispenner.ca/posts/views-for-debugging
19•ezekg•3d ago•8 comments

Activeloop (YC S18) Is Hiring Member of Technical Staff – Back End Engineering

https://careers.activeloop.ai/
1•davidbuniat•3h ago

Margin debt surges to record high

https://www.advisorperspectives.com/dshort/updates/2025/07/23/margin-debt-surges-record-high-june-2025
123•pera•4h ago•143 comments

Sütterlin

https://en.wikipedia.org/wiki/S%C3%BCtterlin
44•anonu•3d ago•34 comments

In a first, Google has released data on how much energy an AI prompt uses

https://www.technologyreview.com/2025/08/21/1122288/google-gemini-ai-energy/
68•jeffbee•1h ago•59 comments

Why is D3 so Verbose?

https://theheasman.com/short_stories/why-is-d3-code-so-long-and-complicated-or-why-is-it-so-verbose/
38•TheHeasman•5h ago•25 comments

Unification (2018)

https://eli.thegreenplace.net/2018/unification/
62•asplake•3d ago•13 comments

AI crawlers, fetchers are blowing up websites; Meta, OpenAI are worst offenders

https://www.theregister.com/2025/08/21/ai_crawler_traffic/
115•rntn•4h ago•49 comments

Why are anime catgirls blocking my access to the Linux kernel?

https://lock.cmpxchg8b.com/anubis.html
707•taviso•1d ago•754 comments

Show HN: I replaced vector databases with Git for AI memory (PoC)

https://github.com/Growth-Kinetics/DiffMem
152•alexmrv•9h ago•36 comments

Show HN: I was curious about spherical helix, ended up making this visualization

https://visualrambling.space/moving-objects-in-3d/
823•damarberlari•1d ago•132 comments

A Conceptual Model for Storage Unification

https://jack-vanlightly.com/blog/2025/8/21/a-conceptual-model-for-storage-unification
10•avinassh•2h ago•0 comments

Home Depot sued for 'secretly' using facial recognition at self-checkouts

https://petapixel.com/2025/08/20/home-depot-sued-for-secretly-using-facial-recognition-technology-on-self-checkout-cameras/
278•mikece•1d ago•368 comments

Sixteen bottles of wine riddle

https://chriskw.xyz/2025/08/11/Wine/
38•chriskw•3d ago•11 comments

A statistical analysis of Rotten Tomatoes

https://www.statsignificant.com/p/is-rotten-tomatoes-still-reliable
201•m463•15h ago•114 comments

To Infinity but Not Beyond

https://meyerweb.com/eric/thoughts/2025/08/20/to-infinity-but-not-beyond/
36•roosgit•6h ago•2 comments

Epson MX-80 Fonts

https://mw.rat.bz/MX-80/
143•m_walden•4d ago•56 comments

Code review can be better

https://tigerbeetle.com/blog/2025-08-04-code-review-can-be-better/
346•sealeck•16h ago•203 comments

Python f-string cheat sheets (2022)

https://fstring.help/cheat/
120•shlomo_z•10h ago•25 comments