| 24 | } |
| 25 | |
| 26 | int phi(int n) |
| 27 | { |
| 28 | float result = n; |
| 29 | for (int p = 2; p * p <= n; ++p) |
| 30 | { |
| 31 | if (n % p == 0) |
| 32 | { |
| 33 | while (n % p == 0) |
| 34 | n /= p; |
| 35 | result *= (1.0 - (1.0 / (float)p)); |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | if (n > 1) |
| 40 | result *= (1.0 - (1.0 / (float)n)); |
| 41 | |
| 42 | return (int)result; |
| 43 | } |
| 44 | |
| 45 | BigUint math::Phi(BigUint e) { |
| 46 | BigUint result = e; |
nothing calls this directly
no outgoing calls
no test coverage detected