
def gcd(a,b):
    x = 1
    for n in xrange(1,a):
        if a%n == 0 and b%n == 0:  
            if n > x:
                x = n
    return x


def lcm(a, b):
    return a*b/gcd(a,b)

def fac(N):
    m=1
    for x in xrange(1,int(N)):
        m=m*(int(N)-x+1)
    return m

def choose(a,b):
    return int(fac(a)/(fac(b)*fac(a-b)))

M=2500

totalwithproperty = 0
total = 0

for N in xrange(M,M+1):
    for n in xrange(1,N/2+1):
        l1=lcm(n,N)/n
        l2=lcm(N-n+1,N)/(N-n+1)
        total += 1
        if l1==l2:
            totalwithproperty += 1
##            print("LCM",l1,l2,"equal for:",n,"&",N-n+1,"of",N)
            print("Ratio with equality:",float(total)/float(totalwithproperty))
            
