Choosing 3 integers such that no two integers are consecutive
Answers
Answered by
0
order by active oldest votes
up vote14down voteaccepted
Assuming that the order of choice doesn’t matter, imagine marking the positions of the rrchosen numbers and leaving blank spaces before, between, and after them for the n−rn−rnon-chosen numbers; if r=3r=3, for instance, you’d get a skeleton like _|_|_|__|_|_|_, where the vertical bars represent the positions in 1,2,…,n1,2,…,n of the chosen numbers. The remaining n−rn−r numbers must go into the r+1r+1 open slots in the diagram, and there must be at least one of them in each of the r−1r−1 slots in the middle. After placing one number in each of those slots, we have n−r−(r−1)=n−2r+1n−r−(r−1)=n−2r+1 numbers left to place arbitrarily in the r+1r+1 slots. This is a standard stars-and-bars problem: there are
((n−2r+1)+(r+1)−1(r+1)−1)=(n−r+1r)((n−2r+1)+(r+1)−1(r+1)−1)=(n−r+1r)
ways to do it. The reasoning behind the formula is reasonably clearly explained at the link.
up vote14down voteaccepted
Assuming that the order of choice doesn’t matter, imagine marking the positions of the rrchosen numbers and leaving blank spaces before, between, and after them for the n−rn−rnon-chosen numbers; if r=3r=3, for instance, you’d get a skeleton like _|_|_|__|_|_|_, where the vertical bars represent the positions in 1,2,…,n1,2,…,n of the chosen numbers. The remaining n−rn−r numbers must go into the r+1r+1 open slots in the diagram, and there must be at least one of them in each of the r−1r−1 slots in the middle. After placing one number in each of those slots, we have n−r−(r−1)=n−2r+1n−r−(r−1)=n−2r+1 numbers left to place arbitrarily in the r+1r+1 slots. This is a standard stars-and-bars problem: there are
((n−2r+1)+(r+1)−1(r+1)−1)=(n−r+1r)((n−2r+1)+(r+1)−1(r+1)−1)=(n−r+1r)
ways to do it. The reasoning behind the formula is reasonably clearly explained at the link.
Similar questions