n = 6
k = 3
min = 0 
for i in range(0,n):
    for l in range(1,n+1):
        if n%l == 0 and k > 0:
            k -= 1
            min = l
if k < 0 or k > 0:
    print("0")
else:
    print(min)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: