import itertools


def largets_prime_factor(num):
	"""
	Returns the largest prime factor of num.
	"""
	prime_factors = []
	for n in itertools.count(2):
		if n > num:
			break
		if num%n == 0:
			prime_factors.append(n)
			while (num%n == 0):
				num = num/n
	return max(prime_factors)