fork download
  1. #include <stdio.h>
  2.  
  3. g(a,b){return!a?b:g(b%a,a);}
  4. i;r;f(n){for(i=2,r=1;i<n;i++)r+=(g(i,n)==1);}
  5. t;k;s(m){for(k=m,t=0;!t&(k<m*m);)f(++k),t=(r==m);}
  6.  
  7. main()
  8. {
  9. for(int x=1; x<50; x++)
  10. {
  11. s(x);
  12.  
  13. if(t) printf(" %d ~ phi(%d) \n", x, k);
  14. }
  15. }
  16.  
Success #stdin #stdout 0.85s 10320KB
stdin
Standard input is empty
stdout
 2 ~ phi(3) 
 4 ~ phi(5) 
 6 ~ phi(7) 
 8 ~ phi(15) 
 10 ~ phi(11) 
 12 ~ phi(13) 
 16 ~ phi(17) 
 18 ~ phi(19) 
 20 ~ phi(25) 
 22 ~ phi(23) 
 24 ~ phi(35) 
 28 ~ phi(29) 
 30 ~ phi(31) 
 32 ~ phi(51) 
 36 ~ phi(37) 
 40 ~ phi(41) 
 42 ~ phi(43) 
 44 ~ phi(69) 
 46 ~ phi(47) 
 48 ~ phi(65)