feat: upate phi
This commit is contained in:
@@ -17,7 +17,9 @@ public class Phi {
|
||||
public static BigInteger phi(BigInteger n) {
|
||||
BigInteger p = BigInteger.valueOf(0);
|
||||
BigInteger i = BigInteger.valueOf(1);
|
||||
// for i \in [1, n)
|
||||
while (i.compareTo(n) < 0) {
|
||||
// gcd(i, n) = 1
|
||||
if (i.gcd(n).equals(BigInteger.ONE)) {
|
||||
p = p.add(BigInteger.ONE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user