I have noticed, during the period I spent studying RSA, that Euler's Totient function can be calculated in another way than $ϕ(N) =(p-1).(q-1)$
Let me explain myself by pointing to a brief example:
$p = 131$
$q = 11953$
$N= p*q = 1565843$
The totient defines the quantity of positive integers less or equal than $N$ coprime with $N$. So we calculate it:
$ϕ(N) = (p-1)(q-1) = 1553760$
But I have realized that this way can also be obtained:
How many multiples of p are under N? q multiples of p
How many multiples of q are under N? p multiples of q
These previous statements show the quantity of integers NOT coprime with $N$ that are less or equal to $N$. It's just the opposite of the Euler's Totient.
So the equation is the following:
$ϕ(N) = N - p - q + 1$
In the example:
$ϕ(N) = 1565843 - 131 - 11953 + 1$
$ϕ(N) = 1553760$
I suppose that this method is well documented over there. I just want to know if this is a good praxis for using in an implementation (for example).
Thanks for your time!