ygrek on Nostr: So apparently this is school #math for some kids but there is a thing called ...
So apparently this is school #math for some kids but there is a thing called subfactorial - how many permutations exist for N elements where none of the elements stay in the same position. There are several formulas how to compute it, i came up with quite an ugly one, but there is a very cute derivation for a simple formula `D(n)=(n-1)(D(n-1)+D(n-2))`, see
https://en.wikipedia.org/wiki/Derangement . The thing that blew my mind is that it is precisely approximated by rounding `n! / e` - this is just insane.
Published at
2026-09-06 17:26:17 UTCEvent JSON
{
"id": "811ddf1ce96a7f7d21bb6df87fdc1b7114ff793b9f36a890ffb74b6820f6e2fc",
"pubkey": "fe046cb4158d2d6133974beb609afaf77e08561daa3ec554c926a6ea2d8e9b8c",
"created_at": 1788715577,
"kind": 1,
"tags": [
[
"t",
"math"
]
],
"content": "So apparently this is school #math for some kids but there is a thing called subfactorial - how many permutations exist for N elements where none of the elements stay in the same position. There are several formulas how to compute it, i came up with quite an ugly one, but there is a very cute derivation for a simple formula `D(n)=(n-1)(D(n-1)+D(n-2))`, see https://en.wikipedia.org/wiki/Derangement . The thing that blew my mind is that it is precisely approximated by rounding `n! / e` - this is just insane.",
"sig": "8a6257434ef26eab3dac81e70bac7fe91cd484b8b057eb0d3e484a55de42440a88828424923b82fe4a3fcb9e485247678b0d27194ae59377c641621415b62249"
}