|
|
A038156
|
|
a(n) = n! * Sum_{k=1..n-1} 1/k!.
|
|
20
|
|
|
0, 0, 2, 9, 40, 205, 1236, 8659, 69280, 623529, 6235300, 68588311, 823059744, 10699776685, 149796873604, 2246953104075, 35951249665216, 611171244308689, 11001082397556420, 209020565553571999, 4180411311071440000, 87788637532500240021, 1931350025715005280484
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
COMMENTS
|
The number of permutations of all proper nonempty subsets of an n element set. - P. Christopher Staecker, May 9 2024
Also number of operations needed to create all permutations of n distinct elements using Algorithm L (lexicographic permutation generation) from Knuth's The Art of Computer Programming, Vol. 4, chapter 7.2.1.2. Sequence gives number of comparisons required to find j in step L2 (see answer to exercise 5). - Hugo Pfoertner, Jan 24 2003
Related to number of operations of addition and multiplication to evaluate a determinant of order n by cofactor expansion - see A026243.
For n>1, the number of possible ballots where there are n candidates and voters may identify their top m most preferred ones, where 0 < m < n. - Shaye Horwitz, Jun 28 2011
For n > 1, a(n) is the expected number of comparisons required to sort a random list of n distinct elements using the "bogosort" algorithm. - Andrew Slattery, Jun 02 2022
|
|
REFERENCES
|
D. E. Knuth: The Art of Computer Programming, Volume 4, Combinatorial Algorithms, Volume 4A, Enumeration and Backtracking. Pre-fascicle 2B, A draft of section 7.2.1.2: Generating all permutations.
|
|
LINKS
|
|
|
FORMULA
|
a(n) = floor((e-1)*n!) - 1.
|
|
EXAMPLE
|
a(2) = floor((2.718... - 1)*2) - 1 = 3 - 1 = 2,
a(3) = floor((2.718... - 1)*6) - 1 = 10 - 1 = 9.
|
|
MAPLE
|
a:= proc(n) option remember;
`if`(n<2, 0, a(n-1)*n+n)
end:
|
|
MATHEMATICA
|
Join[{0}, FoldList[#1*#2 + #2 + #1 + 1 &, 0, Range@ 20]] (* Robert G. Wilson v, Feb 21 2015 *)
|
|
PROG
|
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,easy
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|