X = 5

count = 0
diag = 1

while True:
    if count + diag >= X:
        pos = X - count  
        if diag % 2 == 0:
            numerator = pos
            denominator = diag - pos + 1
        else:
            numerator = diag - pos + 1
            denominator = pos

        print(f"{numerator}/{denominator}")
        break

    count += diag
    diag += 1

Embed on website

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