Let ${A}_{1},{A}_{2},\mathrm{\dots},{A}_{n}$ be subsets of a set $S$ that are not necessarily disjoint. Then the number of elements in the set $S\backslash \left({A}_{1}\cup {A}_{2}\cup \mathrm{\cdots}\cup {A}_{n}\right)$ is

26.18.1 | $$ | ||

The number of positive integers $\le N$ that are not divisible by any of the primes ${p}_{1},{p}_{2},\mathrm{\dots},{p}_{n}$ (§27.2(i)) is

26.18.2 | $$ | ||

With the notation of §26.15, the number of placements of $n$ nonattacking rooks on an $n\times n$ chessboard that avoid the squares in a specified subset $B$ is

26.18.3 | $$n\mathrm{!}+\sum _{t=1}^{n}{\left(-1\right)}^{t}{r}_{t}\left(B\right)\left(n-t\right)\mathrm{!}.$$ | ||

The number of ways of placing $n$ labeled objects into $k$ labeled boxes so that at least one object is in each box is

26.18.4 | $${k}^{n}+\sum _{t=1}^{n}{\left(-1\right)}^{t}\left(\begin{array}{c}k\\ t\end{array}\right){\left(k-t\right)}^{n}.$$ | ||

Note that this is also one of the counting problems for which a formula is given in Table 26.17.1. Elements of $N$ are labeled, elements of $K$ are labeled, and $f$ is onto.