2

While observing my cheap robot vaccum cleaner and how crypto mining pools work, I got one question.

Let's say a room is a N by N grid.

A robot would randomly pick a square in this grid and clean it.

The probability to pick any square is uniform and it is possible that the robot visit a same square multiple times.

If the robot was smart, it would take exactly N^2 attempts to clean the entire room.

How many attempt on average would it take for the dumb robot to clean the entire room?

TSR
  • 507

1 Answers1

3

This is the same as the coupon collector problem with $N^2$ coupons. That Wikipedia article explains why the expected number of attempts is $$N^2 \left( \frac 1 1 + \frac 1 2 + \frac 1 3 + \cdots + \frac 1 {N^2} \right).$$

Depending on your goals, there probably isn't a helpful closed form for $H_n$; see some specific rigorous results here. However, the Wikipedia page on harmonic numbers gives the approximation $$\lim_{n \to \infty} H_n - \ln(n) \to \gamma$$ where $\gamma$ is a small "error term" constant, around $0.58$. So if an approximate answer is good enough then that should give you what you need.

David Clyde
  • 5,399
  • Thanks for this, is there a known expressing of the harmonic number without an infinite sum term ? For example, the basel problem solved by euler ? – TSR Dec 14 '22 at 02:29
  • @TSR I edited in a comment about how to compute (approximately) $H_n$. – David Clyde Dec 14 '22 at 02:38
  • 1
    Thanks for the update, in short, it doesn't https://math.stackexchange.com/questions/52572/do-harmonic-numbers-have-a-closed-form-expression – TSR Dec 14 '22 at 03:37