```
class Solution(object):
def getPermutation(self, n, k):
res, now='', [i for i in xrange(1,n+1)]
for i in xrange(n-1,-1,-1):
index, k=(k-1)/math.factorial(i), k%math.factorial(i)
res+=str(now[index])
del now[index]
return res
```