JOIN
 Select a Forum     Round Tables New Member Discussions News Discussions Algorithm Matches Marathon Matches NASA Tournament Lab TopCoder Cookbook High School Matches Sponsor Discussions Development Forums Design Forums Search | Watch Thread  |  My Post History  |  My Watches  |  User Settings View: Flat  | Threaded  | Tree Previous Thread  |  Next Thread Forums Tutorial Discussions Prime Numbers, Factorization and Euler Function (Article) Euler function
 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
 Forums Tutorial Discussions Prime Numbers, Factorization and Euler Function (Article) Euler function Previous Thread  |  Next Thread