I was recently running tests to get items to drop randomly in an old-school computer RPG. I wanted to verify that all items in a range, say, 1-80 would drop in a certain dungeon. But I couldn't do things all at once.
After one test run with the 80-item dungeon, here might be example output from my array of item drops:
Items dropping in D: 1-5, 7-12, 15-21, ...., 73-80
In other words, my program doesn't just print out "yes no yes no" but lumps together a range of consecutive numbers that randomly turned up, where a range is defined as any set of $x \ge 1$ continuous integers that have been rolled. So 1 alone would count as a range, and so would 40-78.
I noticed that this expanded for a while, then it shrank. But I'm curious what m would give the maximum number of ranges. This necessitates a formula for the expected number of ranges in terms of $m$ and $n$, and I have to admit I don't know where to start there. Obviously I could run Monte Carlo simulations to give a guess, but I'm interested in the general formula/derivation.