fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define int long long
  4. #define endl '\n'
  5. #define all(x) x.begin(), x.end()
  6. #define rall(x) x.rbegin(), x.rend()
  7. const int MOD = 1e9 + 7;
  8. int phi(int n)
  9. {
  10. int result = n;
  11. for (int i = 2; i * i <= n; i++)
  12. {
  13. if (n % i == 0)
  14. {
  15. while (n % i == 0)
  16. n /= i;
  17. result -= result / i;
  18. }
  19. }
  20. if (n > 1)
  21. result -= result / n;
  22. return result;
  23. }
  24. int32_t main()
  25. {
  26. ios::sync_with_stdio(false);
  27. cin.tie(NULL);
  28. int a, b;
  29. cin >> a >> b;
  30. cout << phi(a) << " " << phi(b) << " " << phi(a*b) << endl;
  31. return 0;
  32. }
Success #stdin #stdout 0.01s 5304KB
stdin
Standard input is empty
stdout
37642648006656 61133615020032 -8481756005237607936