A box contains $n$ ropes. You randomly tie up any two loose ends until there is none left. Let $X$ be the number of loops. What is $E(X)$?
I've only been able to solve the problem when the number of rope is defined (say, $n=2$ or $n=3$), but I approached the solution by calculating the probability of each possible $X$ value and calculating the expectation by the weighted average of the probability. I feel like there should be an easier solution to get to the general case.