Math, asked by rtshbhaskar, 11 months ago

who know CPR in math​

Answers

Answered by subiksha200618
0

Answer:

Im working on a problem where i have 2 variables

A= (1,2,3) B= (3,2,1)

I have to calculate the number of permutations, and the number of paths by swaping adjancent numbers until A becomes B

For permutations Im currently using the following function in python

nPr = (math.factorial(n))/(math.factorial(n-n))

This one works as intended and the result is ok (in this case nPr = 6), however how can I calculate the number of paths (swaps of pairs) until i get to B?

The combination formula

(n!)/((n-r!)*(r!))

doesnt seem to make the job since it always comes out as 1. (when r = n)

So there has to be another way to do this, I tried using the factorial of nPr however when 6! = 720, meaning theres 720 posible paths to get to B and thats not true.

this was just one example of 3 digits but A and B can be sets of numbers of 2,3,4,5... etc

Similar questions