def tau(n):
	'''the number-theoretic method for computing the number of factors of n'''
	p = primes.pf(n)
	product = 1
	for i in range(len(p)):
		product*= (p[i][1]+1)
	return product
def sigma(n):
	'''the number-theoretic method for computing the sum of the factors of n'''
	if n == 0:
		return 0 
	else:
		product = 1
		p = primes.pf(n)
		for i in range(len(p)):
			product *= ((p[i][0]**(p[i][1]+1))-1)/(p[i][0]-1)
		return product
def mu(n):
	'''mu inversion function'''
	p = primes.pf(n)
	i = 0
	t = 1
	while i < len(p):
		if p[i][1] == 1:
			t*=(-1)
			i+= 1
		else:
			t = 0 
			break
	return t 
def phi(n):
	'''The Euler phi function'''
	p = primes.pf(n)
	for i in range(len(p)):
		n=(n/p[i][0])*(p[i][0]-1)
	return n