JOIN
Get Time
forums   
Search | Watch Thread  |  My Post History  |  My Watches  |  User Settings
View: Flat  | Threaded  | Tree
Previous Thread  |  Next Thread
Euler function | Reply
The function fi(n) finds the value of φ(n):

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


Could someone please tell whether " if(n > 1)" condition would hold true only when n is prime ?
Subject Author Date
Euler function erudite Oct 17, 2012 at 9:19 AM EDT
Re: Euler function stubbscroll Oct 18, 2012 at 6:00 PM EDT
Re: Euler function erudite Oct 28, 2012 at 4:29 PM EDT
RSS