TITLE: Multiplying by irrational numbers in combinatorial problems
QUESTION [28 upvotes]: This is getting no attention on stackexchange.
Everybody knows that the number of derangements of a set of size $n$ is the nearest integer to $n!/e$.
It had escaped my attention until last week, when I wrote this answer, that the number of sequences of distinct elements of a set of size $n$ (including sequences of length $0$) is the nearest integer to $n!e$, provided $n\ge2$.  The sequence whose $n$th term is the nearest integer to $n!e$ satifies the recurrence $x_{n+1} = (n+1)x_n + 1$.
How widespread is this operation of mulitplying by an irrational number and then rounding, in combinatorial problems?  Are there other standard examples?  Is there some general theory accounting for this?  And, while I'm at it, where is this in "the literature"?
(I'm not sure whether we should include things like Fibonacci numbers or solutions of Pell's equation as examples of the same thing.)

REPLY [2 votes]: A remarkable paper by Colin Defant, Troupes, Cumulants, and Stack-Sorting, uncovers another surprising combinatorial appearance of $e$. Let $s$ denote the stack-sorting map (for the definition, see Defant's paper) and let $\mathrm{des}(\pi)$ denote the number of descents of a permutation $\pi$.  If $\sigma$ is a permutation of $\{1, 2,\ldots, n-1\}$ chosen uniformly at random, then the expected value of $\mathrm{des}(s(\sigma))+1$ is
$$\biggl(3 - \sum_{i=0}^n {1\over i!}\biggr)n.$$
Multiplying the above number by $n!$ yields the integer $\lceil n!(3 - e)n\rceil$. You might expect that there is some simple connection to derangements, but no combinatorial connection to derangements is known (as of 2021).