1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265
| \documentclass{beamer} \usepackage{ctex, hyperref} \usepackage[T1]{fontenc} \usepackage[most]{tcolorbox} \usepackage{ctex}
\usepackage{latexsym,amsmath,xcolor,multicol,booktabs,calligra} \usepackage{graphicx,pstricks,listings,stackengine} \usepackage{etoolbox}
\author{NaraFluorine} \title{贝尔数 Bell Numbers} \subtitle{\url{https://oeis.org/A000110}} \institute{吉林大学软件学院} \date{2025年6月19日} \usepackage{JilinUniv}
\def\cmd#1{\texttt{\color{red}\footnotesize $\backslash$#1}} \def\env#1{\texttt{\color{blue}\footnotesize #1}} \definecolor{deepblue}{rgb}{0,0,0.5} \definecolor{deepred}{rgb}{0.6,0,0} \definecolor{deepgreen}{rgb}{0,0.5,0} \definecolor{halfgray}{gray}{0.55} \definecolor{bblue}{RGB}{51,102,153} \definecolor{strongred}{RGB}{200,0,0} \definecolor{lightred}{RGB}{255,240,240}
\lstset{ basicstyle=\ttfamily\small, keywordstyle=\bfseries\color{deepblue}, emphstyle=\ttfamily\color{deepred}, stringstyle=\color{deepgreen}, numbers=left, numberstyle=\small\color{halfgray}, rulesepcolor=\color{red!20!green!20!blue!20}, frame=shadowbox, }
\tcbset{ myblock/.style={ enhanced, colback=deepblue!5, colframe=bblue, coltitle=white, fonttitle=\bfseries, title=formula, attach boxed title to top left={yshift=-2mm,xshift=2mm}, boxed title style={ colback=bblue, colframe=bblue, rounded corners }, sharp corners=south, boxrule=0.5pt, drop shadow } }
\tcbset{ prove/.style={ enhanced, colback=lightred, colframe=strongred, coltitle=white, fonttitle=\bfseries, title=proof, boxed title style={ colback=strongred, colframe=strongred, boxrule=0pt, top=1mm, bottom=1mm, left=2mm, right=2mm, rounded corners }, sharp corners=south, boxrule=0pt, drop shadow, left=2mm, right=2mm, top=1mm, bottom=1mm } }
\newif\ifskipTOC \skipTOCfalse
\AtBeginSection[]{ \ifskipTOC \else \begin{frame}{Outline} \tableofcontents[currentsection] \end{frame} \fi }
\begin{document}
\kaishu \begin{frame} \setbeamertemplate{headline}{} \vfill \centering \titlepage \vfill \end{frame}
\skipTOCtrue \section{$\mathrm{Introduction}$} \skipTOCfalse
\begin{frame}{集合划分} \begin{itemize} \item 将集合$\mathrm{S}$划分为若干个两两不相交的非空子集的族,且他们的并是$\mathrm{S}$,求有多少种方法? \pause \item 假设集合为${1,2,3}$,则有$5$种划分方法如下: \item $\{\{1\},\{2\},\{3\}\}$ \item $\{\{1\},\{2,3\}\}$ \item $\{\{2\},\{1,3\}\}$ \item $\{\{3\},\{1,2\}\}$ \item $\{\{1,2,3\}\}$ \pause \item 于是我们得到数列 \item $1,2,5,15,52,203,877,4140,21147,115975,...$ \end{itemize} \end{frame}
\skipTOCtrue \section{$\mathrm{Recursion}$} \skipTOCfalse
\begin{frame}{递推公式} \tcbset{width=\textwidth} \begin{tcolorbox}[myblock] \begin{itemize} \item 贝尔数可以如此递推: \end{itemize} $$\mathrm{B}_{\mathit{n}+1}=\sum_{\mathit{k}=0}^{\mathit{n}}\binom{\mathit{n}}{\mathit{k}}\mathrm{B}_{\mathit{k}}$$ \end{tcolorbox} \end{frame}
\begin{frame}{递推公式} \begin{tcolorbox}[prove] $\mathrm{B}_{\mathit{n}+1}$是含有$\mathit{n}+1$个元素集合的划分个数,设$\mathrm{B}_\mathit{n}$的集合为$\{\mathit{b}_1,\mathit{b}_2,\mathit{b}_3,\dots,\mathit{b}_\mathit{n}\}$,$\mathrm{B}_{\mathit{n}+1}$的集合为$\{\mathit{b}_1,\mathit{b}_2,\mathit{b}_3,\dots,\mathit{b}_\mathit{n},\mathit{b}_{\mathit{n}+1}\}$,那么可以认为$\mathrm{B}_{\mathit{n}+1}$是有$\mathrm{B}_{\mathit{n}}$增添了一个$\mathit{b}_{\mathit{n}+1}$而产生的,考虑元素$\mathit{b}_{\mathit{n}+1}$. \begin{itemize} \item 假如它被单独分到一类,那么还剩下$\mathit{n}$个元素,这种情况下划分数为$\binom{\mathit{n}}{\mathit{n}}\mathrm{B}_{\mathit{n}}$; \item 假如它和某$1$个元素分到一类,那么还剩下$\mathit{n}-1$个元素,这种情况下划分数为$\binom{\mathit{n}}{\mathit{n}-1}\mathrm{B}_{\mathit{n}-1}$; \item 假如它和某$2$个元素分到一类,那么还剩下$\mathit{n}-2$个元素,这种情况下划分数为$\binom{\mathit{n}}{\mathit{n}-2}\mathrm{B}_{\mathit{n}-2}$; \item ...... \end{itemize} 以此类推即可. \end{tcolorbox} \end{frame}
\skipTOCtrue \section{$\mathrm{Nature}$} \skipTOCfalse
\begin{frame}{性质} \tcbset{width=\textwidth} \begin{tcolorbox}[myblock] \begin{itemize}[<+-| alert@+>] \item 每个贝尔数都是相应的第二类斯特林数的和. \item 因为第二类斯特林数是把基数为$\mathit{n}$的集合划分为正好$\mathit{k}$个非空集的方法数目. \item $$\mathrm{B}_{\mathit{n}}=\sum_{\mathit{k}=0}^\mathit{n}{\mathit{n}\brace \mathit{k}}$$ \end{itemize} \end{tcolorbox} \end{frame}
\skipTOCtrue \section{$\mathrm{Calculate}$} \skipTOCfalse
\begin{frame}{计算} 之前我们提到了递推公式,时间复杂度是$\mathit{O}(\mathit{n}^2)$的,还可以优化. \begin{itemize} \item 我们把上文递推公式的组合数展开: \item $$\mathrm{B}_{\mathit{n}+1}=\sum_{\mathit{k}=0}^{\mathit{n}}\binom{\mathit{n}}{\mathit{k}}\mathrm{B}_{\mathit{k}}=\sum_{\mathit{k}=0}^\mathit{n}\frac{\mathit{n}!}{\mathit{k}!(\mathit{n}-\mathit{k})!}\times\mathrm{B}_{\mathit{k}}$$ \pause \item 分离$\mathit{k}$和$\mathit{n}$得到: \item $$\frac{\mathrm{B}_{\mathit{n}+1}}{\mathit{n}!}=\sum_{\mathit{k}=0}^\mathit{n}\frac{1}{(\mathit{n}-\mathit{k})!}\times\frac{\mathrm{B}_\mathit{k}}{\mathit{k}!}$$ \pause \item 令$\mathit{f}_\mathit{x}=\frac{1}{\mathit{x}!}$,$\mathit{g}_\mathit{x}=\frac{\mathrm{B}_\mathit{x}}{\mathit{x}!}$,有: \item $$\frac{\mathrm{B}_{\mathit{n}+1}}{\mathit{n}!}=\sum_{\mathit{k}=0}^{\mathit{n}}\mathit{f}_{\mathit{n}-\mathit{k}}\mathit{g}_{\mathit{k}}$$ \end{itemize} \end{frame}
\begin{frame}{计算} 得到的式子 \begin{itemize} \item $$\frac{\mathrm{B}_{\mathit{n}+1}}{\mathit{n}!}=\sum_{\mathit{k}=0}^{\mathit{n}}\mathit{f}_{\mathit{n}-\mathit{k}}\mathit{g}_{\mathit{k}}$$ \item 使用多项式求逆即可,时间复杂度$\mathit{O}(\mathit{n}\log \mathit{n})$. \item 也可以使用分治FFT处理,时间复杂度是$\mathit{O}(\mathit{n}\log^2\mathit{n})$,在此不表. \end{itemize} \end{frame}
\begin{frame}{多项式求逆} \begin{itemize} \item 不妨设$\mathit{F}(\mathit{x})=\sum_{\mathit{i}=0}^\infty \mathit{f_i x^i},\mathit{G}(\mathit{x})=\sum_\mathit{i=0}^\infty \mathit{g_i x^i}$ ,且$\mathit{g}_0=0$ \pause \item 那么有$$\mathit{F}(\mathit{x})\mathit{G}(\mathit{x})=\sum_{\mathit{i}=0}^\infty \mathit{x^i}\sum_{\mathit{j}+\mathit{k}=\mathit{i}}\mathit{f_jg_k}=\mathit{F}(\mathit{x})-\mathit{f}_0\mathit{x}^0$$ \pause \item 所以有$$\mathit{F}(\mathit{x})\mathit{G}(\mathit{x})\equiv(\mathit{F}(\mathit{x})-\mathit{f}_0)\mod \mathit{x^n}$$ \pause \item 所以有$$\mathit{F}(\mathit{x})\equiv\left( \frac{\mathit{f}_0}{1-\mathit{G}(\mathit{x})}\right)\mod \mathit{x^n}$$ \item 使用多项式求逆可以解决,时间复杂度是$\mathit{O}(\mathit{n}\log \mathit{n})$. \end{itemize} \end{frame}
\skipTOCtrue \section{$\mathrm{Example}$} \skipTOCfalse
\begin{frame}{例题} 留给感兴趣的同学们探索. \begin{itemize} \item 板子题1 \item \url{https://uicoj.net/problem/1026} \item 板子题2 \item \url{https://www.luogu.com.cn/problem/P5748} \item 应用1 \item \url{https://codeforces.com/problemset/problem/568/B} \end{itemize} \end{frame}
\skipTOCtrue \section{$\mathrm{End}$} \skipTOCfalse
\begin{frame}{结尾} \begin{center} {\Huge\calligra Thanks!} \end{center} \end{frame}
\end{document}
|