# Stirling numbers of the second kind (stirling_s2)

Stirling number of the second kind: the ways to split n items into k groups.

## How to write it

### stirling_s2(n, k)

**n**

A whole number. Takes a whole number.

**k**

A whole number. Takes a whole number.

## Examples

- $\displaystyle \operatorname{stirling\_s2}(4, 2) = 7$

  `stirling_s2(4, 2)`

  In the solver, `stirling_s2(4, 2)` gives `7`.

  [Open in the solver](https://hilberon.com/?q=stirling_s2%284%2C%202%29)

## Related functions

- [stirling_s1](https://hilberon.com/library/stirling_s1)

  Stirling number of the first kind, with sign.
- [subfactorial](https://hilberon.com/library/subfactorial)

  Subfactorial: how many ways to reorder n items so none stays in place.
- [totient](https://hilberon.com/library/totient)

  Euler's totient: how many whole numbers up to n are coprime to n.
- [squares_r](https://hilberon.com/library/squares_r)

  How many ways a whole number is a sum of a given count of squares, counting order and signs.
- [bell_b](https://hilberon.com/library/bell_b)

  The n-th Bell number: how many ways to split n items into groups.
- [solve_congruence](https://hilberon.com/library/solve_congruence)

  Solve a congruence for a variable.

---
Source: https://hilberon.com/library/stirling_s2
