Example #1
0
	def test_coprimep(self):
		'''
		Test coprime function.
		'''
		res = nt.coprimep(2,5)
		self.assertEqual(res, True)
		res = nt.coprimep(2,10)
		self.assertEqual(res, False)
Example #2
0
def pythagonum(m, n):
	'''
	Calculate pythagorean number.
	'''
	if nt.coprimep(m, n) and nt.odd(m-n):
		return (m**2-n**2, 2*m*n, m**2+n**2)
	else:
		return ()