Within a unit square, given n random uniform points, what is the average distance to the nearest k points? To be precise: if k=2 we are averaging the distances of the 1st and 2nd nearest neighbors to point i.
Here is a reference for the n=2 k=1 solution. Average distance between two randomly chosen points in unit square (without calculus) (for this question I assume calculus is needed)
However, if you rather had n points and were interested in the average distance to the k nearest neighbors is this something that can be solved with an exact answer?
I have produced results empirically for 10,000 iterations:
n=2, k=1: 0.52
n=3, k=2: 0.52 <- intuitively identical to n=2,k=1
n=5, k=4: 0.52 <- intuitively identical to n=2,k=1
n=3, k=1: 0.39
n=5, k=1: 0.28
n=10, k=1: 0.18
n=10, k=2: 0.24
n=10, k=3: 0.28
n=100, k=5: 0.097