Search
 
SCRIPT & CODE EXAMPLE
 

CPP

phi function

int phi(int n) {
    int result = n;
    for (int i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            while (n % i == 0)
                n /= i;
            result -= result / i;
        }
    }
    if (n > 1)
        result -= result / n;
    return result;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: fractional knapsack problem 
Cpp :: invert a binary tree 
Cpp :: Shell-Sort C++ 
Cpp :: A Program to check if strings are rotations of each other or not 
Cpp :: not c++ 
Cpp :: c++ vector operations 
Cpp :: initialisation of a c++ variable 
Cpp :: compile and run cpp file on mac c++ 
Cpp :: calling by reference c++ 
Cpp :: data type c++ 
Cpp :: inverted triangle c++ 
Cpp :: check if cin got the wrong type 
Cpp :: java to puthon converter 
Cpp :: recherche recursive le max dans une liste 
Cpp :: css window id 
Cpp :: OpenCV" is considered to be NOT FOUND 
Cpp :: idnefier endl in undefince 
Cpp :: point in polygon 
Cpp :: The Rating Dilemma codechef solution in c++ 
Cpp :: how to print double value up to 9 decimal places in c++ 
Cpp :: c to c++ code converter 
Cpp :: Z-function 
Cpp :: cpp get keystroke in console only 
Cpp :: c++ vector allocator example 
Cpp :: c++ sort numbers by magnitude/absolute value 
Cpp :: c++ hide credentials 
Cpp :: error c4001 
Cpp :: how to move your chrector in unity 
Cpp :: ue4 execute delegate from blueprint 
Cpp :: how to adjust and delete memory in c, c++ 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =