import math
count_1=0 #The intersection of integer unit circles centred (0,0) (1,0)
K=500
for i in range(0,K+1):
for j in range(0,K+1):
if math.gcd(i,j)==1:
if math.gcd(i-1,j)==1:
count_1 +=1
for a in range(2,7):
count = 0
#The intersection of integer unit circles centred (0,0) (a,0)
for i in range(0,K+1):
for j in range(0,K+1):
if math.gcd(i,j) ==1:
if math.gcd(i-a,j)==1:
count +=1
#If the above equations hold, this point is
#in the intersection of integer circles
ratio = count_1/count
#We compare the intersection count;
#the same ratio applies to the density
print(a, ratio)