• Lvxferre [he/him]@mander.xyz
    link
    fedilink
    English
    arrow-up
    2
    ·
    28 天前
    solution

    Number all bottles in binary, starting from 0000000000. Then the Nth prisoner drinks all wines where the Nth digit is “1”. have each prisoner drinking the wines where a certain digit is “1”.

    So for example. If you had 8 bottles and 3 prisoners (exact same logic):

    • number your wines 000, 001, 010, 011, 100, 101, 110, 111
    • Prisoner 1 drinks wines 100, 101, 110, 111; if he dies the leftmost digit of the poisoned wine is 1, if he lives the poisoned wine starts with 0
    • Prisoner 2 drinks wines 010, 011, 110, 111; if he dies the mid digit is 1, else it’s 0
    • Prisoner 3 drinks wines 001, 011, 101, 111; if he dies the right digit is 1, else it’s 0

    If nobody dies the poisoned wine is numbered 000. And if all die it’s the 111.

      • Lvxferre [he/him]@mander.xyz
        link
        fedilink
        English
        arrow-up
        3
        ·
        28 天前

        No, I only saw it after I solved the problem.

        my reasoning / thought process

        Initially I simplified the problem to one prisoner. The best way to reduce uncertainty was to split the bottles into two sets with 500 bottles each; the prisoner drinks from one, if he dies the poisonous wine is there, otherwise it’s in one of the leftover 500 bottles.

        Then I added in a second prisoner. The problem doesn’t give me enough time to wait for the first prisoner to die, to know which set had the poisonous wine; so I had to have the second prisoner drinking at the same time as the first, from a partially overlapping set. This means splitting the bottles into four sets instead - “both drink”, “#1 drinks it”, “#2 drinks it”, “neither drinks it”.

        Extending this reasoning further to 10 prisoners, I’d have 2¹⁰=1024 sets. That’s enough to uniquely identify which bottle has poison. Then the binary part is just about keeping track of who drinks what.