#P5395. 第二类斯特林数·行

第二类斯特林数·行

Description

The Stirling number of the second kind {nm}\begin{Bmatrix} n \\m \end{Bmatrix} is the number of ways to partition nn distinct elements into mm identical non-empty sets.

Given nn, for every integer i[0,n]i \in [0,n], you need to compute {ni}\begin{Bmatrix} n \\i \end{Bmatrix}.

Since the answer can be very large, you must output the result modulo 167772161\bm{167772161} (225×5+1\bm{2^{25}\times 5+1}, which is a prime).

Input Format

A single line containing a positive integer nn, as described above.

Output Format

A single line containing n+1n+1 non-negative integers.

Output, in order, the values of $\begin{Bmatrix} n \\0 \end{Bmatrix},\begin{Bmatrix} n \\1 \end{Bmatrix},\begin{Bmatrix} n \\2 \end{Bmatrix},\dots,\begin{Bmatrix} n \\n \end{Bmatrix}$.

3

0 1 3 1

Hint

For 20%20\% of the testdata, n1000n \leqslant 1000.

For 100%100\% of the testdata, 1n2×1051 \leqslant n \leqslant 2\times 10^5.

Translated by ChatGPT 5