Nice partition

In this problem, we say that a partition of the numbers {1, …, n} is
nice if

- it has at least two subsets,

- and every subset has at least two elements.

Additionally, we only consider partitions that are qualitatively
different.

For instance, for n = 5 we only have one nice partition:
{{1, 2}, {3, 4, 5}}. Notice that {{1, 2, 3, 4, 5}} would not fulfil the
first property above, {{2}, {1, 3, 4, 5}} would not fulfil the second
property above, while {{2, 3}, {1, 4, 5}} would be basically the same
partition as the only one given.

Given n, how many nice partitions do we have?

Input

Input consists of several cases, each one with an n between 1 and
3 ⋅ 10⁴.

Output

For every n, print the number of nice partitions of {1, …, n} modulo
10⁸ + 7.

Problem information

Author: Xavier Molinero

Generation: 2026-01-25T10:15:23.161Z

© Jutge.org, 2006–2026.
https://jutge.org
