Wrong Row formula
Core recursion formula:
D (n) = (n-1) [D (n-2) + D (n-1)]
Specifically, d (1) = 0, D (2) = 1.
Question: 10 different books are on the shelves. is now re-placed so that each book is not in the original position. How many kinds of pendulum?
This problem to promote, is the wrong row problem , is one of the problems in combinatorial mathematics. Consider an arrangement of n elements that, if all the elements in an arrangement are not in their original position, then this arrangement is called a staggered row of the original arrangement. The number of rows in the N element is recorded as d (N). The problem of arranging the number of rows in the wrong order is called the problem of the wrong row or the more listed problem.
The problem of wrong-row problems was first studied by Nicolas Bernoulli and Euler, so it is also known in history as Bernoulli-Euler's problem of loading the wrong envelopes. There are many specific versions of this problem, such as when you write n letters to n different envelopes, how many of them are loaded in the wrong envelope? Another example of four people write a greeting cards each other to give, how many kinds of gift method? The greeting cards cannot be given to himself, so it is also a typical problem of wrong row.
Question: 10 different books are on the shelves. is now re-placed so that each book is not in the original position. How many kinds of pendulum?
This problem to promote, is the wrong row problem, is one of the problems in combinatorial mathematics. Consider an arrangement of n elements that, if all the elements in an arrangement are not in their original position, then this arrangement is called a staggered row of the original arrangement. The number of rows in the N element is recorded as d (N). The problem of arranging the number of rows in the wrong order is called the problem of the wrong row or the more listed problem.
The problem of wrong-row problems was first studied by Nicolas Bernoulli and Euler, so it is also known in history as Bernoulli-Euler's problem of loading the wrong envelopes. There are many specific versions of this problem, such as when you write n letters to n different envelopes, how many of them are loaded in the wrong envelope? Another example of four people write a greeting cards each other to give, how many kinds of gift method? The greeting cards cannot be given to himself, so it is also a typical problem of wrong row.
recursive derivation of the wrong-row formula
When n numbered elements are placed in n numbered positions, the number of methods that do not correspond to the element number and position number is represented by D (N), then D (n-1) indicates that the n-1 number element is placed in the n-1 number position, the number of methods that do not correspond, and other analogies.
The first step, put the nth element in a position, such as position k, altogether there are n-1 methods;
The second step is to put the element numbered K, at this time there are two situations: ⑴ put it to position N, then, for the remainder of the n-1 element, because the K element is placed in position n, the remaining n-2 elements have D (n-2) method, the ⑵ k element does not put it to position N, at this time, for this n-1 element, there is D ( n-1) Species method;
The Comprehensive
D (n) = (n-1) [D (n-2) + D (n-1)]
Specifically, d (1) = 0, D (2) = 1.
The following is deduced from this recursive relationship:
For the sake of convenience, set D (k) = k! N (k), k = 1, 2, ..., N,
then n (1) = 0, n (2) =.
N≥3, n! N (n) = (n-1) (n-1)! N (n-1) + (n-1)! N (n-2)
That is, NN (n) = (n-1) n (n-1) + N (n-2)
So there are N (n)-n (n-1) =-[N (n-1)-N (n-2)]/n = ( -1/n) [ -1/(n-1)] [ -1/(n-2)] ... ( -1/3) [N (2)-n (1)] = ( -1) ^n/n!.
So
N (n-1)-N (n-2) = ( -1) ^ (n-1)/(n-1)!,
N (2)-n (1) = (-1) ^2/2!.
Added, you can get
N (n) = (-1) ^2/2! + ... + ( -1) ^ (n-1)/(n-1)! + ( -1) ^n/n!
So
D (n) = n! [( -1) ^2/2! + ... + ( -1) ^ (n-1)/(n-1)! + ( -1) ^n/n!].
This is the wrong row formula.
principle of tolerance and repulsion
The principle of tolerance can also be used to introduce the formula of the wrong line:
Positive integers 1, 2, 3, ..., n all arranged with n! Species, where K-bits are arranged in K (n-1)! When k is taken 1, 2, 3, ..., N, Total (n-1)! The arrangement is at least one of the lil bit, because the number of the wrong row is asked, so the arrangement should be subtracted, but at the same time there are two number of good rows of the arrangement more excluded once, should be made up; The same time there are three of good rows of the arrangement of more than one, should be ruled out; To continue this process, get the number of rows in the wrong order
D (n) = n! -n!/1! + n!/2! -n!/3! + ... + ( -1) ^n*n!/n! =∑ (K=2~n) ( -1) ^k * n! /k!,
i.e. d (n) = n! [1/0!-1/1! + 1/2!-1/3! + 1/4! + ... + ( -1) ^n/n!].
Wherein, ∑ represents the hyphen, K=2~n is a range of added; 0! = 1, can be compared with 1!
Simplified Formula
The prototype of the wrong-row formula is D (n) = n! (1/0!-1/1! + 1/2!-1/3!-... + ( -1) ^n/n!), it is inconvenient to calculate when n is large. A simplified formula for reference is D (n) = [n!/e+0.5], where E is the base of the natural logarithm, [x] is the integer portion of x.
Prove:
Because 1/e = e^ (-1) = 1/0! -1/1! + 1/2! -1/3! -... + ( -1) ^n/n! + Rn (-1),
where RN (-1) is the remainder, equals ( -1) ^ (n+1) * E^u/(N+1)!, and U∈ (-1, 0).
So, D (n) = n! * e^ ( -1)-( -1) ^ (n+1) * E^u/(n+1), U∈ (-1, 0).
and |n! rn| = | ( -1) ^ (n+1) * E^u/(n+1) | = E^u/(n+1) ∈ (1/[e (n+1)], 1/(n+1)), the remainder (the absolute value) is less than 1/2 even at N=1.
Therefore, whether n! RN is exactly negative, n! The integer portion of/E + 1/2 must be the same as M (N).
For relatively small n, the result and simple explanation are:
D (0) = 1 (all elements are put back in place, not in the wrong position)
D (1) = 0 (only one element is left, it is not possible to put the error in any way)
D (2) = 1 (both swap positions)
D (3) = 2 (ABC becomes BCA or cab)
D (4) = 9
D (5) = 44
D (6) = 265
D (7) = 1854
D (8) = 14833
D (9) = 133496
D (10) = 1334961
Mathematical knowledge--the formula of wrong row