```
class Solution(object):
def getPermutation(self, n, k):
"""
:type n: int
:type k: int
:rtype: str
"""
nums = [str(_) for _ in range(1,n+1)]
k -= 1
ans = ""
for i in range(n)[::-1]:
ans += nums.pop(k / math.factorial(i))
k %= math.factorial(i)
return ans
```