# HG changeset patch
# User Yann LaigleChapuy <yannlaiglechapuy@gmail.com>
# Date 1257701931 3600
# Node ID c2c63ff6690c9665494129a1b83f4982617b12ad
# Parent ae8ee6fb3b129d52117358037c6f19bf07842d25
bug in from_lehmer_code
diff r ae8ee6fb3b12 r c2c63ff6690c sage/combinat/permutation.py
a

b


3055  3055  n = len(lehmer) 
3056  3056  if n==0: 
3057  3057  return Permutation([]) 
3058   perm = [None] * n 
3059   
3060   #Convert the factoradic to a permutation 
3061   temp = [None] * n 
3062   for i in range(n): 
3063   lehmer[i] += 1 
3064   temp[i] = lehmer[i] 
3065   
 3058  
 3059  perm = map(lambda x:x+1, lehmer) 
3066  3060  perm[n1] = 1 
3067  3061  for i in reversed(range(n1)): 
3068   perm[i] = temp[i] 
 3062  pi = perm[i] 
3069  3063  for j in range(i+1, n): 
3070   if perm[j] >= perm[i]: 
 3064  if perm[j] >= pi: 
3071  3065  perm[j] += 1 
3072  3066  
3073   return Permutation([ p for p in perm ]) 
 3067  return Permutation(perm) 
3074  3068  
3075  3069  def from_reduced_word(rw): 
3076  3070  r""" 