Readit News logoReadit News
chriskw commented on Sixteen bottles of wine riddle   chriskw.xyz/2025/08/11/Wi... · Posted by u/chriskw
rmunn · 2 days 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.

chriskw · 2 days ago
Yeah, I really like the sorting formulation! I didn't notice until after I'd written out the intended solution, but it's basically radix sort going from most significant to least significant bit.
chriskw commented on Sixteen bottles of wine riddle   chriskw.xyz/2025/08/11/Wi... · Posted by u/chriskw
chrisshroba · 2 days 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, ..."

chriskw · 2 days ago
Before publishing I found this while trying to see if there was a already a riddle like it out there (closest I could find was the 1000 barrels of wine riddle mentioned at the beginning): https://puzzles.nigelcoldwell.co.uk/

You can also think of this riddle as a very symmetric version of Wordle, where instead of trying to solve for a permutation of letters you're solving for a permutation of years.

chriskw commented on Sixteen bottles of wine riddle   chriskw.xyz/2025/08/11/Wi... · Posted by u/chriskw
fainpul · 2 days ago
Could just label the years 2000 - 2015. It just says "sixteen possible years", not where these years are on the timeline.
chriskw · 2 days ago
I originally set it up like that, but felt having to explain that you need to subtract 2000 before doing the binary conversion was unnecessary and kind of distracting
chriskw commented on That fractal that's been up on my wall for years   chriskw.xyz/2025/05/21/Fr... · Posted by u/chriskw
mbty · 3 months ago
Really cool and in-depth, thank you!

I believe that there is a typo in the pattern formula (right after "Looking closely you might pick up on the pattern"): it should read

  5**(n/2) instead of 5**n
  5**((n-1)/2) instead of 5**(n-1)
(\overrightarrow{10*4} is [0, 25] but your original formula gives [0, 625])

Also, regarding Knuth's mistake: Youtube comments point out that his fractal is in fact correct; he just mistook the beginning point with the end point. Loosely speaking, the fractal is symmetrical about its middle turn, which is precisely the one Knuth believed to be incorrect. All in all, he still made a fractal-related mistake, so the conclusion holds.

chriskw · 3 months ago
Good catch, corrected the formula!
chriskw commented on That fractal that's been up on my wall for years   chriskw.xyz/2025/05/21/Fr... · Posted by u/chriskw
leni536 · 3 months ago
Found a space-filling curve for the wallflower:

https://onlinetools.com/math/l-system-generator?draw=ABCD&sk...

The previous one fills out the Koch island.

chriskw · 3 months ago
That's really cool! I tried to get something to work last week on pen and paper but couldn't get anything to stick. Is there a strategy you used or did you just go by feel?

Edit: just noticed how you encoded a flip (AB <--> CD) between iterations like how the matrix flips the orientation of space. Super neat!

chriskw commented on That fractal that's been up on my wall for years   chriskw.xyz/2025/05/21/Fr... · Posted by u/chriskw
tcshit · 3 months ago
Yeah, maybe it is. It would be cool to make it much bigger, frame it and put it on the wall. Or create a mosaic tiled artwork, similar to Knuth’s dragon curve wall.
chriskw · 3 months ago
Yeah, it's in the last image and in the thumbnail at very top (which I realize now is really hard to spot on mobile), intentionally not in the spotlight to leave space for the twist at the end.

https://chriskw.xyz/images/fractal/thumbnail.jpg

I think it would work perfectly as a mosaic eventually, but for the time being I'm perfectly content with the "rustic" 8x11 graph paper sized one taped to the wall. Currently planning to put up a slice of the orthotopeflower as a companion piece once I find matches for the colored pencils I used back then.

chriskw commented on That fractal that's been up on my wall for years   chriskw.xyz/2025/05/21/Fr... · Posted by u/chriskw
baq · 3 months ago
This went much deeper and harder than expected. One has to admire the dedication.

Question to the author: what would you recommend to hang on my kid’s wall today?

chriskw · 3 months ago
I'm by no means a parenting expert, but my answer would be anything related to something they feel passion or wonder for in the moment. I snuck in a paragraph near the end about burnout. At the root of the problem for me was that I lost the feeling of fascination and curiosity I had for math and programming, and doing this write-up helped me tap into that feeling of childlike wonder that used to come easily.
chriskw commented on That fractal that's been up on my wall for years   chriskw.xyz/2025/05/21/Fr... · Posted by u/chriskw
CliffStoll · 3 months ago
Outstanding work and a delightful read.
chriskw · 3 months ago
Thanks Cliff, it means a ton coming from you! The videos from you and all the other folks on Numberphile always inspired me to see the beauty in math growing up :)
chriskw commented on That fractal that's been up on my wall for years   chriskw.xyz/2025/05/21/Fr... · Posted by u/chriskw
CBLT · 3 months ago
Well written! Would you mind sharing how you came up with the "middle out" numbering system? I can never seem to come up with something this inspired when I'm doing math problems by myself.
chriskw · 3 months ago
The post presents it a bit out of order, but it was mostly from realizing at some point that the way the fractal grows by a factor of 5, base 5 number systems, and the "spiral" mentioned in the post can all fit together. I also thought a lot about how to programmatically draw the fractal and a natural way would be to start from the middle and zoom out.

There's an apocryphal story about Richard Feynman about how he used to keep a dozen or so random problems in the back of his mind and made a little bit of progress on them every time he saw a connection, until finally he'd solve one and everyone would think he magically figured it out instantly. This was a bit similar except I'm not nearly at that level and I've only been able to do that for one problem instead of a dozen.

u/chriskw

KarmaCake day248February 3, 2023
About
I'm just a guy

Website: https://chriskw.xyz/

Email: <website.xyz>@gmail.com

View Original