Help wanted for a interesting problem.

Revision en1, by EarthMessenger, 2023-04-12 12:07:43

You're given an integer n, answer the number of inversions in all the derangement permutations of length n. For example, if n = 3, there are two derangement premutations, 231 and 312, so the answer is 4.

There is such a sequence in OEIS. But I want to know how this is derived.

It's welcomed if you have other linear solution.

Tags math, derangement, inversions, oeis

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English EarthMessenger 2023-04-12 12:07:43 399 Initial revision (published)