answersLogoWhite

0


Best Answer

Implement this method:

public static int totient(int n) {

int count = 0;

for(int i = 1; i < n; i++)

if(gcd(n,i) == 1)

count++;

return count;

}

You can implement your own gcd(int a, int b) method, or find one of the many online.

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What's a JAVA program for Euler's totient function?
Write your answer...
Submit
Still have questions?
magnify glass
imp