Skip to main content
2 of 2
updated to discuss vectors and not sets
Peter Shor
  • 6.3k
  • 4
  • 55
  • 65

The number of $m$-subsets of {$1,2,\ldots,n$} with distance at least $k$ between any pair is $n - (k-1)(m-1) \choose m$.

Proof: for any subset of size $m$ of the first $n-(k-1)(m-1)$ integers, you can get a subset $S$ of the first $n$ with $d(S)\geq k$ by just adding $k-1$ consecutive integers after each of the first $m-1$ elements of $S$.

So your answer is ${ n - (k-1)(m-1) \choose m } -{ n - k(m-1) \choose m }$ .

UPDATE The intended question was about vectors and not sets. Essentially the same proof works; see the comments.

Peter Shor
  • 6.3k
  • 4
  • 55
  • 65