Addendum-2 just added to my question.
Addendum just added to my question.
$\underline{\textbf{Overview}}$
This is a self-answer question of this original question. I strongly suspect that the original question will soon be closed and then deleted.
I’m trying to get the amount of combinations of 5 numbers from one to twenty without duplicates and without 3,4,and 5 consecutive running numbers.
$\underline{\textbf{Clarification}}$
Let $N = \{1,2,\cdots, 20\}$.
How many distinct subsets of $N$ are there where:
- The subset has exactly $5$ elements.
- The subset does not contain $3$ consecutive elements.
Here, consecutive elements are elements $(k), (k+1), (k+2).$
For example, both of the following sets are satisfactory:
- $\{1, 2, 4, 5, 7\}$
- $\{1, 3, 5, 7, 9\}$.
Further, each of the following sets are unsatisfactory:
- $\{1, 2, 3, 14, 18\}$
- $\{2, 3, 4, 5, 17\}$
- $\{8, 9, 10, 11, 12\}$.
$\underline{\textbf{My Background}}$
About $50$ years ago I took a Probability course in college and did ok. I have forgotten much of the theory, and usually rely exclusively on intuition to attack Probability (or Combinatorics) problems.
If relevant, some decades ago I survived but have forgotten much of:
"Real Analysis : Volume 1 : 2nd Ed." (Apostol, 1966).
The first $(2/3)$ of "Elementary Number Theory" (Uspensky and Heaslett, 1938) [through quadratic reciprocity].
$\underline{\textbf{Problem Relevance}}$
In my experience, there are three typical approaches to this type of problem:
- The Direct Approach
- Recursion
- Inclusion-Exclusion
This particular problem interested me, because of the challenge involved in providing three distinct solutions, one for each of the above approaches. However, exploring Inclusion-Exclusion, I concluded that the math involved was too ugly to be reasonably feasible.
However, I was able to find two distinct Direct Approaches to offer.
$\underline{\textbf{My Work}}$
See my self - answers.
For clarity, I have provided a separate answer for :
- A Direct Approach
- An Alternate Direct Approach
- Recursion
Addendum
Given the answers provided by others, it seems to me that the one pending challenge is to find some elegant solution that is based primarily on Inclusion-Exclusion.
I would be very interested if someone could present such a solution.
Edit
Mike Earnest added an Inclusion-Exclusion response to his answer.
Addendum-2
Finally conquered my own private Inclusion-Exclusion challenge for this problem. Just added a separate Inclusion-Exclusion answer.
Instead of subsets, think of binary strings with $5$ ones and $15$ zeroes. Such a string can be uniquely represented as $$ 0^{z_1}\;1\;0^{z_2}\;1\;0^{z_3}\;1\;0^{z_4}\;1\;0^{z_5}\;1\;0^{z_6} $$ For example, $(z_1,z_2,\dots,z_6)=(1,5,3,0,6,0)$ would represent $01000001000110000001$. Therefore, binary strings are in bijection with nonnegative integer solutions to the equation $$ z_1+z_2+z_3+z_4+z_5+z_6=15. $$ Such a solution will result in a binary string with three consecutive ones if and only if there exists an $i\in \{2,\dots,4\}$ for which $z_i=z_{i+1}=0$. By looking at the largest index $i$ for which $z_i=z_{i+1}=0$, we see that binary strings with three consecutive ones fall into three disjoint classes:
$z_2=z_3=0$, $z_4>0$. (The first three ones are consecutive, but not the first four). Given this, $z_4-1$ is an arbitrary nonnegative integer, so we can count these by counting solutions to $z_1+(z_4-1)+z_5+z_6=(15-1)$, the number of which is $\binom{(15-1)+4-1}{4-1}=\binom{17}3$ via normal stars and bars.
$z_3=z_4=0,z_5>0$. (The middle three ones are consecutive, possibly including the first one, but excluding the last one). By the logic, there are $\binom{17}3$ such solutions.
$z_4=z_5=0$. (The last three ones are consecutive, possibly including the second and first ones). This time, there are $\binom{18}3$ solutions.
Therefore, the number of solutions without three consecutive ones is $$ \binom{20}5-\binom{17}3-\binom{17}3-\binom{18}3=13{\,}328. $$
It is also easy to rephrase this in terms of the principle of inclusion exclusion. Let...
Using the $z_1+\dots+z_6=15$ paradigm, and applying PIE to count the intersection of the complemetnts of $A_1,A_2$ and $A_3$ (here, $AB$ denotes $A\cap B)$, we see $$ \begin{align} |A_1^c\cap A_2^c\cap A_3^c| &=\binom{20}5-|A_1|-|A_2|-|A_3|+|A_1A_2|+|A_1A_3|+|A_2A_3|-|A_1A_2A_3| \\&=\binom{20}5-\binom{18}{3}-\binom{18}{3}-\binom{18}{3}+\binom{17}2+\binom{16}1+\binom{17}2-\binom{16}1 \end{align} $$ Explanations:
In $A_1$, we have $z_2=z_3=0$, which corresponds to solving $z_1+z_4+z_5+z_6=15$, the number of solutions to which is $\binom{18}3$. Same goes for $A_2$ and $A_3$.
In $A_1A_2$, we have $z_2=z_3=z_4=0$, so $z_1+z_5+z_6=15$, counted by $\binom{17}2$. Same for $A_2A_3$.
In $A_1A_3$, we have $z_2=z_3=z_4=z_5=0$, so $z_1+z_6=15$, counted by $\binom{16}1$. Same goes for $A_1A_2A_3$.