Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I'm looking for a way to enumerate the $k$-permutations of a $n$ element set; that is, if $A=\left\{1, \dots, n\right\}$ and $K=\left\{(p_1, \dots, p_k)\mid p_i\in A\wedge i\neq j\implies p_i\neq p_j\right\}$; then I'd like a bijection

$f:\left\{1, \dots, \frac{n!}{(n-k)!}\right\}\to K$

along with it's inverse. In particular I'd like something computable rather than enumerative since clearly I could enumerate them by hand, but this becomes memory inefficient for large $n$ and $k$.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

You could us a partial Lehmer code: A number in mixed base $n,\dotsc,n-k+1$ that specifies which of the remaining slots is to be used in each of $k$ selection steps.

share|improve this answer
1  
I think I see (I use this for permutations of $n$ elements, so the $k=n$ case), just use the first $k$ digits and you still have a unique representation.. –  Michael Conlen Oct 26 '12 at 19:59
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.