I should calculate order of a givent element of multiplicative group modulo n. This n might, or might not be a prime.
The thing is, I need to know order of the group itself as input for this algorithm. For a group where n is prime, this is easy, the order is n-1. But what if n is a composite number? Do I really have to calculate the Euler totient function (as suggested here) to determine the order of the group and then use this algorithm to calculate the order of the element? Or am I somehow able to calculate the order of a given element based on just factorization of n (teacher suggested this should be possible)?