Revisit : $20\choose 5$ subsets without 3,4 or 5 consecutive numbers

175 Views Asked by At

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.

6

There are 6 best solutions below

4
On BEST 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...

  • $A_1$ be the set of strings where the first three ones are consecutive.
  • $A_2$ be the set of strings where the middle three ones are consecutive.
  • $A_3$ be the set of strings where the last three ones are consecutive.

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$.

0
On

$\underline{\textbf{A Direct Approach}}$

For any set $T$ with a finite number of elements, let $|T|$ denote the number of elements in $T$.

Let $N$ denote the set $\{1, 2, \cdots, 20\}.$
Let $A$ denote the following collection of subsets of $N$:
$\{S \subseteq N ~: ~S ~\text{has exactly} ~5 ~\text{elements}\}.$

For $~k \in \{1, 2, \cdots, 18\},~$
let $B_k$ denote the collection of all subsets $S$ in $A$ where:

  • $S~$ specifically contains the elements $~(k), (k+1),~$ and $~(k + 2)$.

  • When $k > 1$, the subset $S$ does not contain the element $(k-1)$.

This means that if $S$ is in $B_k$, $S$ contains a group of (at least) $3$ consecutive elements such that the lowest element in this group is the element $k$. This implies that $B_1, B_2, B_3, \cdots, B_{18}$ are all disjoint sets.

This implies that the desired computation is

$$ |A| - \left[\sum_{k=1}^{18} |B_k|\right]. $$


To enumerate $|B_2|,~$ for any subset $S$ in $B_2$:

  • $S$ does not contain the element $(1)$.

  • $S$ does contain the elements $~(2), (3),~$ and $~(4)$.

  • $S$ contains any $2$ other elements from $\{5, 6, \cdots, 20\}$.

Therefore

$$|B_2| = \binom{16}{2}.\tag1 $$

Similarly, for $k \in \{3, 4, \cdots, 16\}$,
for any subset $S$ in $B_k$:

  • $S$ does not contain the element $(k-1)$.

  • $S$ does contain the elements $~(k), (k+1),~$ and $~(k+2)$.

  • $S$ contains any $2$ other elements from the $16$ remaining elements in $N$.

Therefore

$$|B_3| = |B_4| = \cdots = |B_{16}| = \binom{16}{2}.\tag2 $$


$\underline{\text{Special Handling}}$

For $~k \in \{1, 17, 18\}$ the computation of $|B_k|$ will need special handling.

For any subset $S$ in $B_1$:

  • $S$ does contain the elements $~(1), (2),~$ and $~(3)$.

  • $S$ contains any $2$ other elements from $\{4, 5, \cdots, 20\}$.

Therefore,

$$|B_1| = \binom{17}{2}. \tag3 $$

For any subset $S$ in $B_{17}$:

  • $S$ does contain the elements $~(17), (18),~$ and $~(19)$.

  • $S$ contains any $2$ other elements from either $\{20\}$ or $\{1, 2, \cdots, 15\}$.

Therefore,

$$|B_{17}| = |B_2| = \binom{16}{2}. \tag4 $$

For any subset $S$ in $B_{18}$:

  • $S$ does contain the elements $~(18), (19),~$ and $~(20)$.

  • $S$ contains any $2$ other elements from $\{1, 2, \cdots, 16\}$.

Therefore,

$$|B_{18}| = |B_2| = \binom{16}{2}. \tag5 $$


$\underline{\text{Final Computation}}$

Putting the computations in (1), (2), (3), (4), and (5) above all together,

$$|A| - \left[\sum_{k=1}^{18} |B_k|\right]$$

$$ = \binom{20}{5} - \left[17 \times \binom{16}{2}\right] - \binom{17}{2}$$

$$ = 15504 - \left[17 \times 120\right] - 136 = 13328.$$

0
On

$\underline{\textbf{An Alternate Direct Approach}}$

For a set $T$ with a finite number of elements,
let $|T|$ denote the number of elements in $S$.

Let $N$ denote the set $\{1, 2, \cdots, 20\}.$

Let $A$ denote the following collection of subsets of $N$:
$\{S \subseteq N ~: ~S ~\text{has exactly} ~5 ~\text{elements}\}.$

Let $B$ denote the following collection of subsets $S$ that are elements in $A$:
$S$ has $3$ consecutive elements but does not have $4$ consecutive elements.

Let $C$ denote the following collection of subsets $S$ that are elements in $A$:
$S$ has $4$ consecutive elements but does not have $5$ consecutive elements.

Let $D$ denote the following collection of subsets $S$ that are elements in $A$:
$S$ has $5$ consecutive elements.

Let $a,b,c,d$ denote $|A|, |B|, |C|, |D|,$ respectively $\implies$

  • $a = \displaystyle \binom{20}{5} = 15504.$
  • The desired computation is $a - (b + c + d).$

$\underline{\text{To Compute} ~b}$

For $k \in \{1, 2, \cdots, 18\},$

  • let $B_k$ denote the collection of subsets $S$ where
    $\{S \in B ~: ~S ~\text{contains the elements} ~k, k+1, ~\text{and} ~k+2\}.$
  • let $b_k$ denote $|B_k|$.

This implies that $\displaystyle ~b = \sum_{k=1}^{18} b_k$.

$\displaystyle b_1 = \binom{16}{2}$.
This is because any set $S \in B_1$ contains the elements
$(1), (2),$ and $(3)$
does not contain the element $(4)$,
and contains $2$ elements from $\{5, 6, \cdots, 20\}$.

Similarly, $\displaystyle ~b_{18} = \binom{16}{2}.$

$\displaystyle b_2 = \binom{15}{2}$.
This is because any set $S \in B_2$ contains the elements
$(2), (3),$ and $(4)$
does not contain either of the elements $(1)$ or $(5)$,
and contains $2$ elements from $\{6, 7, \cdots, 20\}$.

Similarly, for $\displaystyle ~k \in \{3, 4, \cdots, 17\}, ~b_k = \binom{15}{2}$.

Therefore,

$$b = \left[2 \times \binom{16}{2}\right] + \left[16 \times \binom{15}{2}\right] = 240 + 1680 = 1920.$$


$\underline{\text{To Compute} ~c}$

For $k \in \{1, 2, \cdots, 17\},$

  • let $C_k$ denote the collection of subsets $S$ where
    $\{S \in C ~: ~S ~\text{contains the elements} ~k, k+1, k+2, ~\text{and} ~k+3\}.$
  • let $c_k$ denote $|C_k|$.

This implies that $\displaystyle ~c = \sum_{k=1}^{17} c_k$.

$\displaystyle c_1 = \binom{15}{1}$.
This is because any set $S \in C_1$ contains the elements
$(1), (2), (3)$ and $(4)$
does not contain the element $(5)$,
and contains $1$ element from $\{6, 7, \cdots, 20\}$.

Similarly, $\displaystyle ~c_{17} = \binom{15}{1}.$

$\displaystyle c_2 = \binom{14}{1}$.
This is because any set $S \in C_2$ contains the elements
$(2), (3), (4)$ and $(5)$
does not contain either of the elements $(1)$ or $(6)$,
and contains $1$ element from $\{7, 8, \cdots, 20\}$.

Similarly, for $\displaystyle ~k \in \{3, 4, \cdots, 16\}, ~b_k = \binom{14}{1}$.

Therefore,

$$c = \left[2 \times \binom{15}{1}\right] + \left[15 \times \binom{14}{1}\right] = 30 + 210 = 240.$$


$\underline{\text{To Compute} ~d}$

For $S \in D$, there are $(16)$ possible choices for the lowest element in $S$.

$$d = 16.$$


$\underline{\text{Final Computation}}$

$$a - (b + c + d) = 15504 - (1920 + 240 + 16) = 13328.$$

0
On

$\underline{\textbf{Recursion}}$

For any set $T$ with a finite number of elements, let $|T|$ denote the number of elements in $T$.

For $~n \in \Bbb{Z^+},~$ let $~A_n$ denote the set $\{1, 2, \cdots, n\}.$

For $n \in \Bbb{Z^+}, ~n \geq 4, ~n \leq 20, ~k \in \{3, 4, 5\}$:

  • let $~B_n^k ~$ denote the collection of subsets $~S \in A_n$ where
    $S$ has exactly $k$ elements and
    $S$ does not have (at least) $3$ consecutive elements.

  • let $C_n^k ~$ denote the collection of subsets $~S \in B_n^k$ where
    $S$ does not contain the element $(n)$.

  • let $D_n^k ~$ denote the collection of subsets $~S \in B_n^k$ where
    $S$ does contain the element $(n)$ but does not contain the element $(n-1)$.

  • let $E_n^k ~$ denote the collection of subsets $~S \in B_n^k$ where
    $S$ does contain both of the elements $(n)$ and $(n-1)$.

Let $~b(n,k), ~c(n,k), ~d(n,k), ~e(n,k),~$ denote
$~|B_n^k|, ~|C_n^k|, ~|D_n^k|, ~|E_n^k|,~$ respectively.

This implies that $~b(n,k) = c(n,k) + d(n,k) + e(n,k).$

The final answer will be $b(20,5)$.


The spirit of this approach would have me compute $b(n,4)$ recursively, and then compute $b(n,5)$ recursively. This would lengthen the answer. Instead, I am going to implememt a moderate compromise.

I will compute $b(n,4)$ directly, in a manner similar to that taken in the Direct Approach answer. Then, I will compute $b(n,5)$ recursively.


$\underline{\text{Direct Computation of} ~b(n,4)} ~: ~5 \leq n \leq 20$

There are $~\displaystyle \binom{n}{4} ~$ subsets of $A_{n}$ that contain exactly $4$ elements.

For any such pertinent subset $S$ that has exactly $4$ consecutive elements, there are $(n-3)$ possible choices for the lowest element in $S$.

For any such pertinent subset $S$ that has exactly $3$ consecutive elements (i.e. but not $4$ consecutive elements), there are $(n-2)$ possible choices for the lowest element of the $3$ consecutive elements in $S$.

If the lowest of the $3$ consecutive elements in $S$ is either $1$ or $(n-2)$, then the set $S$ can be constructed in $(n-4)$ ways. If instead, the lowest element in $S$ is between $2$ and $(n-3)$ inclusive, the set $S$ can be constructed in $(n-5)$ ways.

Therefore

$$b(n,4) = \binom{n}{4} - (n - 3) - \left[2 \times (n - 4)\right] - \left[(n-4) \times (n-5)\right]$$

$$ = \binom{n}{4} - (n - 3) - \left[(n-3) \times (n-4)\right] $$

$$ = \binom{n}{4} - (n - 3)^2.$$


$\underline{\text{Recursive Computation of} ~b(n,5)} ~: ~7 \leq n \leq 20$

To compute $~e(n,5) = |E_n^5|,$ first consider the computation of $b(n-3, 3)$ and then consider the compuation of $c(n-2,3)$.

To compute $b(n-3,3)$ consider that there are $\binom{n-3}{3}$ ways of selecting $3$ elements from $A_{n-3}.$ If such a subset of $A_{n-3}$ does have $3$ consecutive elements, then there are $(n-5)$ choices for the lowest element in the subset.

Therefore, $\displaystyle ~b(n-3,3) = \binom{n-3}{3} - (n-5) = \binom{n-3}{3} - n + 5.$

Further, there is a bijection between $B_{n-3}^3$ and $C_{n-2}^3.$ That is, simply start with any subset that is in $B_{n-3}^3$ and do not use element $(n-2)$.

Similarly, there is a bijection between $C_{n-2}^3$ and $E_n^5$. That is, simply start with any subset that is in $C_{n-2}^3$, and do use both of the elements $(n)$ and $(n-1)$.

Therefore,

$$e(n,5) = c(n-2,3) = b(n-3,3) = \binom{n-3}{3} - n + 5.$$


Similarly, there is a bijection between $D_n^5$ and $C_{n-1}^4$. Simply start with any subset that is in $C_{n-1}^4$ and do use element $n$.

Also, there is a bijection between $C_{n-1}^4$ and $B_{n-2}^4.$ Simply start with any subset that is in $B_{n-2}^4$ and do not use element $(n-1)$.

Therefore,

$$d(n,5) = c(n-1,4) = b(n-2,4) = \binom{n-2}{4} - (n - 5)^2.$$


Finally, there is a bijection between $C_n^5$ and $B_{n-1}^5.$ Simply start with any subset that is in $B_{n-1}^5$ and do not use element $n$.

It should be noted that $B_6^5$ is the empty set, so $c(7,5) = b(6,5) = 0.$

So, $$c(n,5) = b(n-1,5).$$

Also, for $n \geq 7$, you have that

$$b(n,5) = c(n,5) + d(n,5) + e(n,5).$$


$\underline{\text{Tabular Computation of} ~b(n,5)} ~: ~7 \leq n \leq 20$

The following table may now be generated.

\begin{array}{| r | r | r | r | r |} \hline n & c(n,5) & d(n,5) & e(n,5) & b(n,5) \\ & = b(n-1,5) & = \displaystyle \binom{n-2}{4} & = \displaystyle \binom{n-3}{3} & = c(n,5) \\ & & - (n - 5)^2 & - n + 5 & + d(n,5) \\ & & & & + e(n,5) \\ \hline 6 & & & & 0 \\ \hline 7 & 0 & 1 & 2 & 3 \\ \hline 8 & 3 & 6 & 7 & 16 \\ \hline 9 & 16 & 19 & 16 & 51 \\ \hline 10 & 51 & 45 & 30 & 126 \\ \hline 11 & 126 & 90 & 50 & 266 \\ \hline 12 & 266 & 161 & 77 & 504 \\ \hline 13 & 504 & 266 & 112 & 882 \\ \hline 14 & 882 & 414 & 156 & 1452 \\ \hline 15 & 1452 & 615 & 210 & 2277 \\ \hline 16 & 2277 & 880 & 275 & 3432 \\ \hline 17 & 3432 & 1221 & 352 & 5005 \\ \hline 18 & 5005 & 1651 & 442 & 7098 \\ \hline 19 & 7098 & 2184 & 546 & 9828 \\ \hline 20 & 9828 & 2835 & 665 & \color{red}{13328} \\ \hline \end{array}

6
On

According to the beautiful explanation , these $5$ numbers can consists of two ways suchthat

  • No consecutive numbers

  • Only one pair of consecutive numbers

So ,

  • For no consecutive numbers :

Lets represent the numbers by letters such that the selected numbers is represened by $\color{blue}{S}$ , and non-selecteds by $\color{red}{S}$.

Now , we must have $15\color{red}{S'}$ and $5\color{blue}{S'}$. Now ,we will distribute these $5$ blue $S'$ among and ends of $15\color{red}{S'}$ . We can do it by $C(16,5)$ ways.For example , one of the distribution is $$\color{blue}{S}\color{red}{S}\color{red}{S}\color{red}{S}\color{blue}{S}\color{red}{S}\color{red}{S}\color{blue}{S}\color{red}{S}\color{blue}{S}\color{red}{S}\color{blue}{S}\color{red}{S}\color{red}{S}\color{red}{S}\color{red}{S}\color{red}{S}\color{red}{S}\color{red}{S}\color{red}{S}$$

Now , think that $$1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20=\color{blue}{S}\color{red}{S}\color{red}{S}\color{red}{S}\color{blue}{S}\color{red}{S}\color{red}{S}\color{blue}{S}\color{red}{S}\color{blue}{S}\color{red}{S}\color{blue}{S}\color{red}{S}\color{red}{S}\color{red}{S}\color{red}{S}\color{red}{S}\color{red}{S}\color{red}{S}\color{red}{S}$$

So , we select the numbers $\{1,5,8,10,12\}$

  • For only one pair of consecutive numbers :

Select one of the possible place among $16$ gaps (ends and between the red letters), and place two blue letters in that place. We can do it by $C(16,1)$ ways.By using the same logic , select $3$ place for the remaining letters among $15$ suitable places by $C(15,3)$.For example , $$\color{blue}{S}\color{red}{S}\color{red}{S}\color{red}{S}\color{blue}{S}\color{red}{S}\color{red}{S}\color{blue}{S}\color{red}{S}\color{red}{S}\color{blue}{S}\color{blue}{S}\color{red}{S}\color{red}{S}\color{red}{S}\color{red}{S}\color{red}{S}\color{red}{S}\color{red}{S}\color{red}{S}$$

Above ,we select $\{1,5,8,11,12\}$

So , the answer is $$C(16,5) + C(16,1) \times C(15,3) = 4368+16 \times455 =11648$$

$\mathbf{EDITION}$: We can also have two separate consecutive numbers such as $\{1,2,5,7,8\}$

So , select $2$ places among $16$ suitable places by $C(16,2)$ to place double blue letters and select one place for the remaining by $C(14,1)$.

For example , $$\color{blue}{S}\color{blue}{S}\color{red}{S}\color{red}{S}\color{red}{S}\color{red}{S}\color{red}{S}\color{red}{S}\color{red}{S}\color{blue}{S}\color{red}{S}\color{red}{S}\color{red}{S}\color{red}{S}\color{red}{S}\color{red}{S}\color{red}{S}\color{red}{S}\color{blue}{S}\color{blue}{S}$$

We select $\{1,2,10,19,20\}$

So , the answer is $$C(16,5) + [C(16,1) \times C(15,3) ]+ [C(16,2) \times C(14,1)] = 4368+[16 \times455] +[120 \times 14] = \color{blue}{13,328}$$

1
On

$\underline{\textbf{Inclusion-Exclusion}}$

This answer is based on Inclusion-Exclusion. The answer contains certain shortcuts that simply didn't occur to me before. That is why I originally (incorrectly) thought that Inclusion-Exclusion was not feasible for this problem.


For any set $T$ with a finite number of elements, let $|T|$ denote the number of elements in $T$.

Let $N$ denote the set $\{1, 2, \cdots, 20\}.$
Let $A$ denote the following collection of subsets of $N$:
$\{S \subseteq N ~: ~S ~\text{has exactly} ~5 ~\text{elements}\}.$

For $~k \in \{1, 2, \cdots, 18\}$:

Let $B_k$ denote the collection of all subsets $S$ in $A$ where:

  • $S~$ specifically contains the elements $~(k), (k+1),~$ and $~(k + 2)$.

This means (for example) that if the subset $S$ is contained in $B_3$, that $S$ contains each of the elements $~(3), (4),~$ and $~(5).~$ This also means that $S$ might or might not not contain any of the elements $~(1), (2), (6),~$ or $~(7)$.

It is necessary to compute $\displaystyle ~|A| - |B_1 \cup B_2 \cup \cdots \cup B_{18}|.$


Let $~T_0~$ denote $~|A|~$.

Let $T_1$ denote $~\displaystyle\sum_{1 \leq i_1 \leq 18} B_{i_1}$.
That is, $T_1$ represents the sum of $\displaystyle \binom{18}{1}$ terms.

Let $T_2$ denote $~\displaystyle\sum_{1 \leq i_1 < i_2 \leq 18} |B_{i_1} \cap B_{i_2}|$.
That is, $T_2$ represents the sum of $\displaystyle \binom{18}{2}$ terms.

For $~r \in \{3,4,\cdots, 18\}$:

Let $T_r$ denote $~\displaystyle\sum_{1 \leq i_1 < i_2 < \cdots < i_r \leq 18} |B_{i_1} \cap B_{i_2} \cap \cdots \cap B_r|$.
That is, $T_r$ represents the sum of $\displaystyle \binom{18}{r}$ terms.

Then, in accordance with Inclusion-Exclusion theory:

$$ |A| - |B_1 \cup B_2 \cup \cdots \cup B_{18}| ~=~ \sum_{r = 0}^{18} (-1)^r T_r. \tag1 $$


$\underline{\text{Intermediate Results}}$

The first time that I considered Inclusion-Exclusion for this problem, I overlooked the results of this section.

For $~r \in \{2, 3, \cdots, 18\},~$ consider
$\displaystyle B_{i_1} \cap B_{i_2} \cdots \cap B_{i_r} ~: ~1 \leq i_1 < i_2 < \cdots < i_r \leq 18.$

Intermediate Result-1 (IR-1):
If $~i_r \geq (i_1 + 3)$ then $~\displaystyle B_{i_1} \cap B_{i_2} \cdots \cap B_{i_r}~$ is the empty set.

Proof:
Construct a subset $S$ from $~\displaystyle B_{i_1} \cap B_{i_2} \cdots \cap B_{i_r}.$
Then $S$ contains the elements $~(i_1), (i_1 + 1), ~$ and $~(i_1 + 2).$
Further, $S$ also contains the elements $~(i_r), (i_r + 1), ~$ and $~(i_r + 2).$
Since $~i_r \geq (i_1 + 3)~$ this implies that the constructed subset $S$ contains $6$ distinct elements.

This is impossible, because each subset $S$ is part of the collection of subsets contained in $A$. This implies that the subset $S$ contains exactly $5$ elements.

Therefore, no such subset $S$ can be constructed.
Therefore, the set $~\displaystyle B_{i_1} \cap B_{i_2} \cdots \cap B_{i_r}~$ equals the empty set.

Intermediate Result-2 (IR-2):
If $~i_r = (i_1 + 2)$ then $~\displaystyle |B_{i_1} \cap B_{i_2} \cdots \cap B_{i_r}|~ = 1.$

Proof:
Construct a subset $S$ from $~\displaystyle B_{i_1} \cap B_{i_2} \cdots \cap B_{i_r}.$
Then $S$ contains the elements $~(i_1), (i_1 + 1), ~$ and $~(i_1 + 2).$
Further, $S$ also contains the elements $~(i_r), (i_r + 1), ~$ and $~(i_r + 2).$
Since $i_r = i_1 +2$, this implies that
$S$ also contains the elements $~(i_1 + 2), (i_1 + 3), ~$ and $~(i_1 + 4).$

Since the subset $S$ contains exactly $5$ elements,
the only possible subset $S$ is the set $\{i_1, i_1 + 1, i_1 + 2, i_1 + 3, i_1 + 4\}.$

Therefore, when $i_r = i_1 + 2$,
$~\displaystyle B_{i_1} \cap B_{i_2} \cdots \cap B_{i_r}~$ only contains one subset.

The results IR-1 and IR-2 will significantly simplify the subsequent computations.


$\underline{\text{Computation of} ~T_0}$

As $A$ is defined:

$$T_0 = |A| = \binom{20}{5} = 15504. \tag2 $$


$\underline{\text{Computation of} ~T_1}$

To compute $T_1$, first consider a subset $S$ constructed from $|B_1|$.
$S$ contains the elements $~(1), (2), ~$ and $~(3).~$
$S$ can also contain any $2$ of the elements from $\{4, 5, \cdots, 20\}.$

Therefore, $~\displaystyle |B_1| = \binom{17}{2}.$
The identical analysis will apply to each of $~B_2, B_3, \cdots, B_{18}$.

Therefore,

$$T_1 = 18 \times \binom{17}{2} = 2448. \tag3 $$


$\underline{\text{Computation of} ~T_2}$

To compute $T_2$, first consider each of the following, separately:

  • $B_{i_1} \cap B_{(i_1 + 1)}.~~$ Regard this as a type-1 set.
  • $B_{i_1} \cap B_{(i_1 + 2)}.~~$ Regard this as a type-2 set.
  • $B_{i_1} \cap B_{i_2} ~: i_2 \geq (i_1 + 3).~~$ Regard this as a type-3 set.

Construct a subset $S$ from $B_{i_1} \cap B_{(i_1 + 1)}$.
Then, $~S~$ contains each of the elements $~(i_1), (i_2), (i_3), ~$ and $~(i_4)$.
$S~$ also contains one more element, which can be any of the other $16$ elements from $~\{1, 2, \cdots, 20\}.$

Therefore $~|B_{i_1} \cap B_{i_1 + 1}| = 16.$
Since $i_1$ can be any element in $~\{1, 2, \cdots, 17\},~$ there are $17$ possible type-1 sets.

Therefore, when computing $T_2$, the partial sum from type-1 sets is
$\displaystyle (17 \times 16) = 272.$

Consider the type-2 set $~B_{i_1} \cap B_{(i_1 + 2)}.$
By IR-2, $~|B_{i_1} \cap B_{(i_1 + 2)}|~=~ 1$.
Since $i_1$ can be any element in $~\{1, 2, \cdots, 16\},~$ there are $16$ possible type-2 sets.

Therefore, when computing $T_2$, the partial sum from type-2 sets is
$\displaystyle (16 \times 1) = 16.$

In a similar fashion, IR-1 implies that any type-3 set must be the empty set.

Therefore,

$$T_2 = 272 + 16 = 288. \tag4 $$


$\underline{\text{Computation of} ~T_3}$

To compute $T_3$, first consider each of the following, separately:

  • $B_{i_1} \cap B_{i_2} \cap B_{i_3} ~: ~i_3 = (i_1 + 2).$
    Regard this as a type-2 set.

  • $B_{i_1} \cap B_{i_2} \cap B_{i_3} ~: ~i_3 \geq (i_1 + 3)$.
    Regard this as a type-3 set.

Consider the type-2 set $B_{i_1} \cap B_{i_2} \cap B_{i_3} ~: ~i_3 = (i_1 + 2)$.
By IR-2, $~|B_{i_1} \cap B_{i_2} \cap B_{i_3}|~=~ 1$.
Since $i_1$ can be any element in $~\{1, 2, \cdots, 16\},~$ there are $16$ possible type-2 sets.

Therefore, when computing $T_3$, the partial sum from type-2 sets is
$\displaystyle (16 \times 1) = 16.$

In a similar fashion, IR-1 implies that any type-3 set must be the empty set.

Therefore,

$$T_3 = 16. \tag5 $$


$\underline{\text{Computation of} ~T_r ~: ~r \geq 4}$

Consider any of the $~\displaystyle \binom{18}{r}~$ sets
$B_{i_1} \cap B_{i_2} \cap \cdots \cap B_{i_r}.$

Since $r \geq 4, i_r \geq (i_1 + 3).$
By IR-1, this implies that
$|B_{i_1} \cap B_{i_2} \cap \cdots \cap B_{i_r}| = 0.$

This applies to each of the $~\displaystyle \binom{18}{r}~$ terms in the computation of $T_r.$

Therefore,

$$T_r = 0 ~: r \geq 4.\tag6 $$


$\underline{\text{Final Computation}}$

Using the results from (1), (2), (3), (4), (5), and (6) above:

$$\sum_{r = 0}^{18} (-1)^r T_r = \sum_{r = 0}^{3} (-1)^r T_r$$

$$= 15504 - 2448 + 288 - 16 = 13328.$$