Python代码
a=int(input())
def trans(n):#进制转换
x=a
arr=[]
while x>=n:
arr.append(x%n)
x//=n
arr.append(x)
arr=arr[::-1]
return sum(arr)
res=0
for i in range(2,a):
res+=trans(i)
def gcd(a,b):
r=1
while r!=0:
r=a%b
a=b
b=r
return a
q=max(res,a-2)
w=min(res,a-2)
c=gcd(q,w)
x=res//c
y=(a-2)//c
print(f'{x}/{y}')