Lehmer code: Difference between revisions

Content deleted Content added
m The secretary problem: wikilink to Secretary problem main article
m Copyedit (minor)
Line 6:
 
==The code==
The Lehmer code makes evidentuse of the fact that there are
:<math>n!=n\times(n-1)\times\cdots\times2\times1</math>
permutations of a sequence of ''n'' numbers. If a permutation ''σ'' is specified by the sequence (''σ''<sub>1</sub>, …, ''σ''<sub>''n''</sub>) of its images of 1, …, ''n'', then it is encoded by a sequence of ''n'' numbers, but not all such sequences are valid since every number must be used only once. By contrast the encodings considered here choose the first number from a set of ''n'' values, the next number from a fixed set of {{math|''n'' − 1}} values, and so forth decreasing the number of possibilities until the last number for which only a single fixed value is allowed; ''every'' sequence of numbers chosen from these sets encodes a single permutation. While several [[encoding]]s can be defined, the Lehmer code has several additional useful properties; it is the sequence