Skip to content

Commit

Permalink
Update EulersFunction.java
Browse files Browse the repository at this point in the history
  • Loading branch information
yanglbme authored Feb 4, 2019
1 parent 6351bf2 commit 12215a1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Others/EulersFunction.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//You can read more about Euler's totient function https://en.wikipedia.org/wiki/Euler%27s_totient_function
// You can read more about Euler's totient function
// https://en.wikipedia.org/wiki/Euler%27s_totient_function
public class EulersFunction {
//This method returns us number of x that (x < n) and gcd(x, n) == 1 in O(sqrt(n)) time complexity;
// This method returns us number of x that (x < n) and gcd(x, n) == 1 in O(sqrt(n)) time complexity;
public static int getEuler(int n) {
int result = n;
for (int i = 2; i * i <= n; i++) {
Expand All @@ -13,7 +14,7 @@ public static int getEuler(int n) {
return result;
}
public static void main(String[] args) {
for(int i = 1; i < 100; i++) {
for (int i = 1; i < 100; i++) {
System.out.println(getEuler(i));
}
}
Expand Down

0 comments on commit 12215a1

Please sign in to comment.