Coprime generation

Coprime : When two numbers have no common factors other than 1.

F.e. 21 and 22 are coprime, 21 and 24 are not.

#coprime generation
def farey(limit): 
	'''Fast computation of Farey sequence as a generator''' 
	# n, d is the start fraction n/d (0,1) initially                             
	# N, D is the stop fraction N/D (1,1) initially                              
	pend = [] 
	n = 0 
	d = N = D = 1 
	while True: 
		mediant_d = d + D 
		if mediant_d <= limit: 
			mediant_n = n + N 
			pend.append((mediant_n, mediant_d, N, D)) 
			N = mediant_n 
			D = mediant_d 
		else: 
			yield n, d 
			if pend: n, d, N, D = pend.pop()
			else: break