#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

Everybody Codes, The Song of Ducks and Dragons [ 2025 ], quest 11, part 3

I am doing the #EverybodyCodes quests this November. ( #coding #puzzle ) Today I’d like to talk about quest 11, part 3. Spoilers.

Everybody Codes, quest 11

This next bit will make much more sense if you are actually familiar with part 3. If you haven’t solved it yourself, you might want to look at this description .

Quest 11, part 3 has been described this way:

  • “Key insight 2 is that each round in a phase effectively only moves one duck from one column to another. Key insight 3 is that in phase 2, when a column get the number of ducks each column ends with, it will never get more/less (it won’t fluctuate). In other words, the number of ducks per column in phase 2 is either monotonically increasing or monotonically decreasing.” Source
  • “If you know that it is sorted, and effectively, every turn one duck moves from the “large” half to the low half, then how many ducks have to be moved to have exactly equal columns in the end?” Source
  • “Phase 2 brings the columns to equilibrium using a left to right flood of deficits. If the left column is smaller than the right, then a single duck moves to the left. When applied across the full range of columns in a single round, the smallest column (which must be on the left) gains a duck and the largest column (which must be on the right) loses a duck. The only way it’s not possible for a duck to move is if the columns are at equilibrium.” Source

Maybe I am dumb and just don’t see, that b actually follows from a.

Maybe I needed more than intuition and “when I used this method, I got the correct result”.

Anyway. I have tried writing a proof.


We have some columns of ducks.

a b c d e f g

a <= b <= c etc.

The average of a-g is x
We can insert |, so that e.g. c <= x < d

a b c | d e f g

WHAT HAPPENS BEFORE |?

Choose the first among a-c (they are left of |), so that the chosen one is strictly smaller than the one to its right.
Call this candidate m.

So we might have

a b c | d … (a < b)
b b c | d … (a = b < c)
c c c | d … (a = b = c < d)

Notice that it is always possible to choose m.

We might have

m b c | d …

In that case the next step is

m+1 b-1 c | d …

As b <= c, it follows that b-1 < c, and the next step is

m+1 b c-1 | d …

This goes on until we reach c and d.

m+1 b c | d-1 …

IMPORTANT: m grows 1, d-g shrinks 1.
IMPORTANT: the list is still sorted. See below what happens when c = d.

We might also have

m m c | d …

In the first round we get 1 or more steps bringing us to this

m m+1 c | d-1 …

In the next round this becomes

m+1 m+1 c | …

IMPORTANT: each m grows 1, d-g shrinks accordingly.
IMPORTANT: given z m’s, each m grows 1, d-g shrinks z.
IMPORTANT: the list is still sorted after each round.

WHAT HAPPENS AFTER |?

Choose the last among d-g, so that the chosen one is strictly larger than the one to its left.
Call this candidate n.

So we might have

… c | d e f g (f < g)
… c | d e f f (e < f = g)
… c | d e e e (d < e = f = g)
… c | d d d d (c < d = e = f = g)

Notice that it is always possible to choose n.

We might have a step, right after d shrinking.

… | d-1 e f n

In that case we go through these steps.

… | d e-1 f n
… | d e f-1 n
… | d e f n-1

IMPORTANT: d goes back to d, n shrinks 1

We might have

… | d-1 e n n

In that case we go through these rounds

… | d e n n-1
… | d e n-1 n-1

IMPORTANT: d goes back to d, each n shrinks 1.
IMPORTANT: given y n’s, each n shrinks 1, a-c grows y.
IMPORTANT: the list is still sorted after y rounds.

We might have

… | n-1 n n n

In that case we end up here after a round

… | n-1 n-1 n-1 n-1

IMPORTANT: d goes to d-1 = n-1, each n shrinks 1. See below what happens when c = d. Otherwise we keep the property that c < d.
IMPORTANT: given y n’s, each n shrinks 1, a-c grows y.
IMPORTANT: the list is still sorted after y rounds.

To sum up:

We begin with a sorted list.
A duck crosses the | in each round.
The list before | will stay sorted.
The list after | will stay sorted or go back to being sorted after a finite number of steps.

We are headed to a situation looking like

m m m | n n n n

or something similar.

This process ends when m = n = x.
1 round before the end we had something like

m-1 m m | n+1 n n n

All the way through the process, c < d. (Ending with m < n+1.)


Maybe all of this is easier to understand watching an example.

#ThisWeeksFiddler, 20251114

This week the #puzzle is: Can You Irrigate the Garden? #probabilities #geometry #trigonometry #average #integration

You and your assistant are planning to irrigate a vast circular garden, which has a radius of 1 furlong. However, your assistant is somewhat lackadaisical when it comes to gardening. Their plan is to pick two random points on the circumference of the garden and run a hose straight between them.
You’re concerned that different parts of your garden—especially your prized peach tree at the very center—will be too far from the hose to be properly irrigated.
On average, how far can you expect the center of the garden to be from the nearest part of the hose?

And for extra credit:

As before, your assistant intends to pick two random points along the circumference of the garden and run a hose straight between them.
This time, you’ve decided to contribute to the madness yourself by picking a random point inside the garden to plant a second peach tree. On average, how far can you expect this point to be from the nearest part of the hose?

Can You Irrigate the Garden?

Highlight to reveal (possibly incorrect) solution:

Program Desmos

And for extra credit:

Desmos

#ThisWeeksFiddler, 20251107

This week the #puzzle is: The Randy Hall Problem #probabilities #MontyHall

You are a producer on a game show hosted by Randy “Random” Hall (no relation to Monty Hall). The show has three doors labeled 1 through 3 from left to right, and behind them are various prizes.
Contestants pick one of the three doors at which to start, and then they press an electronic button many, many times in rapid succession. Each time they press the button, they either stay at their current door or move to an adjacent door. If they’re at door 2 and move to an adjacent door, that new door will be 1 or 3 with equal probability.
Randy has decided that when a contestant presses the button while at door 2, there should be a 20 percent chance they remain at door 2.
As the producer, you want the chances of a contestant ultimately winding up at each of the three doors to be nearly equal after many button presses. Otherwise, mathematicians will no doubt write you nasty letters complaining about how your show is rigged.
If a contestant presses the button while at door 1 (or door 3), what should the probability be that they remain at that door?

And for extra credit:

Randy has an updated suggestion for how the button should behave at door 2. What hasn’t changed is that if a contestant at door 2 and moves to an adjacent door, that new door will be 1 or 3 with equal probability.
But this time, on the first, third, fifth, and other odd button presses that happen to be at door 2, there’s a 20 percent the contestant remains at door 2. On the second, fourth, sixth, and other even button presses that happen to be at door 2, there’s a 50 percent chance the contest remains at door 2.
Meanwhile, the button’s behavior at doors 1 and 3 should in no way depend on the number of times the button has been pressed.
As the producer, you want the chances of winding up at each of the three doors—after a large even number of button presses— to be nearly equal.
If a contestant presses the button while at door 1 (or door 3), what should the probability be that they remain at that door?

The Randy Hall Problem

Highlight to reveal (possibly incorrect) solution:

And for extra credit:

Notes, 372 Pages, Bob Honey Who Just Do Stuff (book 6)

I am listening to the podcast 372 Pages We’ll Never Get Back. In episode 35-38 they discuss Bob Honey Who Just Do Stuff.

372 Pages We’ll Never Get Back

Real or fanfic

The spreadsheet ! A very good performance.

Summary of important advice

Consistency, continuity.

  • The character Honey doesn’t coalesce.
  • Pop granny dreams of Cuban bar boys.
  • Calling it indescribable and then describing it.

Originality.

  • Wake up, sheeple.
  • Intelligence.

Realism. Being human.

  • Honey is dumb? Caultier is dumb?
  • The best at selling ice cream, fireworks etc.
  • Jew speak.
  • It is just very hard to relate to relate to Honey. He’s crazy?

Variety.

  • Repetition of words.

Details: not too many, not too few.

  • Something a little like plot is interrupted by a new info dump.
  • Simply Georgia, 1658???
  • Introducing a word + a footnote, instead of writing a simpler sentence.

POV. Tone.

  • Revolting descriptions.
  • Footnotes for reasons.
  • Satire like delilo or Pynchon. Magic realism?
  • The narrator hates the reader.
  • And perhaps… It could be said…

Use words and phrases correctly.

  • Alliteration, but not good. And it’s a lot. And a cliché.
  • Stringing random words together.
  • Some sentences are hard or impossible to understand. Some words are used wrong.
  • Too many commas.
  • Footnote using insensitivity wrong.
  • Derma, used incorrectly.

Being funny.

  • Is it? Woodshop teachers.
  • Mr. Woodcock.

Other stuff.

  • Aspiring to be a lot. Right? Done artlessly and cynically. No charm.

Ep. 35, prelude + st. 1-5

Don’t do this

  • Words. Alliteration, but not good. And it’s a lot. And a cliché.
  • Aspiring to be a lot. Right? Done artlessly and cynically. No charm.
  • Funny. Is it? Woodshop teachers.
  • Words. Stringing random words together.
  • Variety. Repetition of words.
  • Words. Some sentences are hard or impossible to understand. Some words are used wrong.
  • Tone. Revolting descriptions.
  • Words. Too many commas.
  • Tone. Footnotes for reasons.
  • Cliché. Wake up, sheeple.
  • Details. Something a little like plot is interrupted by a new info dump.
  • Tone. Satire like delilo or Pynchon. Magic realism?
  • Funny. Mr. Woodcock.
  • POV. The narrator hates the reader.

Running gags

  • Settle down.

Oops.

  • Chowcer? A miller’s tale.
  • One of the hard to understand sentences are explained later.

Real or fanfic, 1:08:49

  • Mike is just always guessing.
  • Real ❎ Fanfic ❎ Real ❎ Fanfic ✔️ Fanfic ✔️

Ep. 36, st. 6-9

Don’t do this

  • Originality. Intelligence.
  • Consistency. The character Honey doesn’t coalesce.
  • Realism. Honey is dumb? Caultier is dumb?
  • Words. Footnote using insensitivity wrong.
  • Consistency. Pop granny dreams of Cuban bar boys.
  • POV. And perhaps… It could be said…
  • Realism. The best at selling ice cream, fireworks etc.
  • Racism. Jew speak.

Running gags

  • Pappy.

Real or fanfic, 50:25

  • Real ✔️ Fanfic ✔️ Fanfic ✔️ Real ✔️ Fanfic ✔️

Ep. 37, from st. 10 to about 7 pages into st. 13, including poem, last line: egg on his face.

Don’t do this

  • Words. Derma, used incorrectly.
  • Details. Simply Georgia, 1658???
  • Realism. It is just very hard to relate to relate to Honey. He’s crazy?
  • Details. Introducing a word + a footnote, instead of writing a simpler sentence.

Running gags

  • Settle down. Probably used in every episode from now on.

Oops.

  • Mike read too much!

Real or fanfic, 51:29

  • Real (no guessing) Fanfic ✔️ Real ✔️ Real ✔️ (used before?) Fanfic ✔️

Ranking

  • Eye of Argon, 10/10
  • 64 squares, 10/10
  • Ready Player 1, 8/10
  • Armada, 6/10
  • Tekwar, 5/10 (slipped below Cline)
  • Bob Honey, 0/10

Ep. 38, from st. 13 (the rest) to end

Don’t do this

  • Consistency. Calling it indescribable and then describing it.

Running gags

  • Several long minutes.
  • Indescribable color.

Oops.

  • Ca-moo.

#ThisWeeksFiddler, 20251031

This week the #puzzle is: How Much Does Game 1 Matter? #probabilities #combinatorics #PascalsTriangle #animation

You and your opponent are beginning a best-of-seven series, meaning the first team to win four games wins the series. Both teams are evenly matched, meaning each team has a 50 percent chance of winning each game, independent of the outcomes of previous games.
As the team manager, you are trying to motivate your team as to the criticality of the first game in the series (i.e., “Game 1”). You’d specifically like to educate them regarding the “probability swing” coming out of Game 1—that is, the probability of winning the series if they win Game 1 minus the probability of winning the series if they lose Game 1. (For example, the probability swing for a winner-take-all Game 7 is 100 percent.)
What is the probability swing for Game 1?

And for extra credit:

Instead of a best-of-seven series, now suppose the series is much, much longer. In particular, the first team to win N games wins the series, so technically this is a best-of-(2N−1) series, where N is some very, very large number.
In the limit of large N, what is the probability swing for Game 1 in terms of N? (For full credit, I’m expecting an answer that is rather concise!)

How Much Does Game 1 Matter?

Intermission


This is blog post no. 1002! I forgot to celebrate at no. 1000!
🇩🇰🇩🇰🇩🇰🇩🇰🇩🇰🇩🇰🇩🇰🇩🇰🇩🇰🇩🇰🇩🇰🇩🇰🇩🇰🇩🇰


Highlight to reveal (possibly incorrect) solution:

Program PDF

Just for funzies, I created a video!

And for extra credit:

Desmos