Gormaidos's blog

By Gormaidos, history, 9 years ago, In English

Hey,I would like to know if there is any site with euler's totient function described in detail and how it works. I know a method of how to implement it and why does it work but for complex problems it's very hard for me to understand why it works if I define my vector in another way...

So for a problem where the sum of numbers coprime with i between 0 and 2*i I wrote this code http://ideone.com/dVL50y.

I know why it works,but others wrote like this http://ideone.com/lqPPN4 and I wanna know what phi means to it and how does it work.It looks alike with eratosthenes sieve. Maybe it will clear my mind and will simplify things.

In my code I change the definition of phi[i] from number of coprimes to sum of them,maybe that is not a good approach,at least my mind is dizzy with this..

Thank you very much :)

  • Vote: I like it
  • 0
  • Vote: I do not like it

| Write comment?