1

I believe there are different time complexities for Euler's totient function depending on how you execute the algorithm. The two I know of are:

  1. Iterate through 1 to k and calculate each $\gcd$: $O(n \log(n))$

  2. Factor n first and then use Euler’s product formula: $O(n)$

Are there any other possibilities?

Maarten Bodewes
  • 92,551
  • 13
  • 161
  • 313
dkssud10
  • 125
  • 5

0 Answers0