#ThisWeeksFiddler, 20251121

This week the #puzzle is: A Loopy Holiday Gift Exchange #probabilities #coding #montecarlo #combinatorics

You are participating in a holiday gift exchange with your classmates. You each write down your own name on a slip of paper and fold it up. Then, all the students place their names into a single hat. Next, students pull a random name from the hat, one at a time. If at any point someone pulls their own name from the hat, the whole class starts over, with everyone returning the names to the hat.
Once the whole process is complete, each student purchases a gift for the classmate whose name they pulled. Gifts are handed out at a big holiday party at the end of the year.
At this party, you observe that there are “loops” of gift-giving within the class. For example, student A might have gotten a gift for B, who got a gift for C, who got a gift for D, who got a gift for A. In this case, A, B, C and D would form a loop of length four. Another way to have a loop of length four is if student A got a gift for C, who got a gift for B, who got a gift for D, who got a gift for A. And of course, there are other ways.
If there are a total of five students in the class, how likely is it that they form a single loop that includes the entire class?

And for extra credit:

If there are N students in the class, where N is some large number, how likely is it that they form a single loop that includes the entire class, in terms of N? (For full credit, your answer should be proportional to N raised to some negative power.)

A Loopy Holiday Gift Exchange

Intermission

Oh, look at that, we have a repeat.

Highlight to reveal (possibly incorrect) solution:

Program

A monte carlo program roughly confirms this number.

And for extra credit:

Desmos

2 thoughts on “#ThisWeeksFiddler, 20251121

  1. Hello…you are my favorite Tuesday web page visit since it’s no fun to wait until Friday to see the next Fiddler and last week’s solution! I’ve learned a lot in Desmos from you as well…Cheers!

    Like

Skriv et svar til den skrivende Annuller svar