Euler’s totient formula tells us the number of positive integers less than or equal to a given positive integer that are relatively prime to the latter. This is an important function in combinatorics and number theory. The function can be computed in a fairly simple fashion if we know the list of distinct prime factors of the integer, using the principle of inclusion-exclusion from combinatorics.