eulers totient function
eulers totient function
the most efficient one is the Euclidean algorithm. Here's how you can do it step by step:
1. Start with two numbers: Let’s say the two numbers are aa and bb, where a≥ba \geq b.
2. Divide aa by bb: Find the remainder when aa is divided by bb, which we will call rr.
a=b×q+ra = b \times q + r where qq is the quotient and rr is the remainder. This means
r=amod br = a \mod b.
3. Replace aa with bb and bb with rr: Now, set a=ba = b and b=rb = r.
4. Repeat the process until r=0r = 0. When the remainder is zero, the divisor (the last non-
zero remainder) will be the GCD of the original two numbers.
Example:
3. Replace aa with 18 and bb with 12: Now, a=18a = 18 and b=12b = 12.
You can also find the GCD by finding the prime factorization of both numbers, and then taking
the product of the lowest powers of all common prime factors.
The common prime factors are 2 and 3, and the lowest powers are 212^1 and 313^1. Therefore,
the GCD is:
Conclusion:
Using the Euclidean algorithm is usually the quickest method, especially for larger numbers. The
GCD of two numbers is the largest number that divides both of them without leaving a
remainder.
Composite numbers are positive integers greater than 1 that have more than two distinct
positive divisors. In other words, a composite number can be divided evenly by numbers other
than 1 and itself.
• 4 (divisors: 1, 2, 4)
• 6 (divisors: 1, 2, 3, 6)
• 8 (divisors: 1, 2, 4, 8)
• 9 (divisors: 1, 3, 9)
• 12 (divisors: 1, 2, 3, 4, 6, 12)
Key Characteristics:
• More than two divisors: A composite number has at least one divisor other than 1 and
itself.
• Not prime: Every composite number is not prime, because a prime number has exactly
two distinct positive divisors: 1 and itself.
• Prime numbers: Have exactly two distinct positive divisors: 1 and the number itself.
Example: 2, 3, 5, 7, 11.
1 is not a composite number. It is neither prime nor composite because it only has one divisor
(itself).