PROJECT EULER · #0866
Tidying Up B
A small child has a “number caterpillar” consisting of
Every night, the child's father has to pick up the pieces of the caterpillar that have been scattered across the play room. He picks up the pieces at random and places them in the correct order.
As the caterpillar is built up in this way, it forms distinct segments that gradually merge together.
Any time the father places a new piece in its correct position, a segment of length
Find the expected value of the product for a caterpillar of
Write-up coming later
The complete problem is available here. An approach, code, and answer will be added later.