I watched the video, and was very confused. Turns out the solution is right, but his explanation was - mildly phrased - flawed, when calculating the probability of cycles ("loops") of length N to N/2+1.

I had to reconstruct the correct solution.

But that's YouTube nowadays, trimmed to maximum emotional show effect for the sake of clicks

FWIW: if you still struggle to understand the solution, try the case N=4. There are only 24 = 4! possible configurations of the boxes, this easily fits on a piece of paper.

And you can see why there are exactly N!/C configurations with a cycle length C, for N >= C > N/2. In the case of N=4 there are

Hence the survival rate is at 10/24.

Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery

†) updated


In reply to Re^2: Proving Veritasiums riddle using Perl (simulating "100 prisoners problem") by LanX
in thread Proving Veritasiums riddle using Perl by cavac

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.