Created
January 13, 2019 20:15
-
-
Save steinelu/ed7d0f359b4cde54240df35c6bb46468 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int ggt(int m, int n) | |
{ | |
if(!m) | |
return n; | |
return ggt(n%m , m); | |
} | |
int phi(int n) | |
{ | |
int cnt = 0; | |
for(int i = 1; i < n; i++) | |
{ | |
if(ggt(i, n) == 1) | |
{ | |
cnt++; | |
//printf("%d\n", i); | |
} | |
} | |
return cnt; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment