# Probability Two Birthdays are within M Days

I have a problem which boils down to an extension of the Birthday Problem. If the probability $\bar{p}$ of 2 out of $n$ people having a bithday within $1$ day of each other in $k$ days is:

$$\bar{p}(k;n)=\frac{n!\binom{k}{n}}{k^{n}}$$

What is the probability that 2 birthdays occur within $m$ days?

My intuition tells me it is along the lines of:

$$\bar{p}(k;n,m)=1\times(1-\frac{1}{k-m+1})\times(1-\frac{2}{k-m+1})\times\cdots\times(1-\frac{n-m}{k-m+1})$$

but my math background is weak enough for me to severely doubt myself.

-

The solution can be found in the wiki article

http://en.wikipedia.org/wiki/Birthday_problem#Near_matches

I don't have the derivation of that formula.

-