fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define SIZE 2000
  4. #define ll long long
  5. #define MOD 1000003ll
  6.  
  7. ll phi(ll n)
  8. {
  9. float result = n;
  10. ll num = n;
  11.  
  12. for (ll p = 2; p * p <= n; ++p)
  13. {
  14.  
  15. if (n % p == 0)
  16. {
  17.  
  18. while (n % p == 0)
  19. n /= p;
  20. result *= (1.0 - (1.0 / (float) p));
  21. }
  22. }
  23.  
  24.  
  25. if (n > 1)
  26. result *= (1.0 - (1.0 / (float) n));
  27.  
  28. ll ans = ((ll)result * num / 2);
  29. ans = num * (num + 1) / 2 - ans;
  30.  
  31. return ans % MOD;
  32. }
  33.  
  34. ll phifunc(ll n)
  35. {
  36.  
  37. if (n <= 2) return n;
  38.  
  39. ll temp = n;
  40.  
  41. ll ans = n;
  42.  
  43. for (ll i = 2; i * i <= n; i++)
  44. {
  45. if (n % i == 0)
  46. {
  47. ans -= ans / i;
  48. while (n % i == 0)
  49. n /= i;
  50. }
  51. }
  52.  
  53. if (n > 1)
  54. ans -= ans / n;
  55.  
  56. ans = (ans / 2 * temp);
  57. ans = (temp * (temp + 1) / 2) - ans;
  58.  
  59. return ans;
  60.  
  61. }
  62.  
  63. int main()
  64. {
  65. ios::sync_with_stdio(0);
  66. cin.tie(0); cout.tie(0);
  67. #ifndef ONLINE_JUDGE
  68. freopen("input.txt", "r", stdin);
  69. freopen("output.txt", "w", stdout);
  70. #endif
  71.  
  72. for (int i = 2; i < SIZE; i++)
  73. {
  74. if (phi(i) != phifunc(i))
  75. cout << i << endl;
  76. }
  77.  
  78.  
  79. return 0;
  80. }
Success #stdin #stdout 0s 4396KB
stdin
Standard input is empty
stdout
1650
1680
1710
1716
1722
1734
1740
1746
1750
1752
1758
1764
1770
1776
1782
1788
1794
1800
1806
1812
1818
1820
1824
1830
1836
1840
1842
1848
1850
1854
1860
1862
1866
1870
1872
1876
1878
1880
1884
1890
1896
1900
1902
1904
1908
1910
1914
1918
1920
1924
1926
1930
1932
1936
1938
1940
1944
1946
1950
1956
1958
1960
1962
1968
1970
1972
1974
1976
1978
1980
1984
1986
1988
1990
1992
1995
1998