# factorial

> **factorial**(`n`): `bigint`

Defined in: [packages/combinatorics/src/factorial.ts:41](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/combinatorics/src/factorial.ts#L41)

Count permutations of n items as a bigint, with factorial(0) = 1n.

O(n) multiplications.

## Parameters

### n

`number`

## Returns

`bigint`

## Throws

With `INVALID_COUNT` for an invalid count or `COUNT_TOO_LARGE` if n exceeds `COMBINATORICS_MAX_COUNT`.
