# How to use the Inversions function?

The Inversions function counts the number of inversions in permutation p.

When I try it, I didn't got a number as the result.

How to use it correctly?

• In the future, please post your code as text, rather than as images. – MarcoB Jun 15 '20 at 19:49
• OK, thank you for the suggestion. I'll follow it. @MarcoB – Just a learner Jun 15 '20 at 19:50

perm = FromCycles[{{1, 4, 2, 5}, {3}}];

• The Combinatorica documentation isn't too detailed, but it has a ToCycles[p] function, so I guessed that the permutations were like this. Also, if you have a cycles expressed permutation with no other cycles like for example {1,2}, make sure to do FromCycles[{{1,2}}] with a double pair of {} to get the positional form. – flinty Jun 15 '20 at 20:01