Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- int gcd(int a,int b)
- {
- if(a<b)
- return gcd(b,a);
- if(a%b==0)
- return b;
- else return gcd(b,a%b);
- }
- int phi(int x)
- {
- int ans=0;
- for(int i=1;i<=x;++i)
- {
- if(gcd(x,i)==1)
- ans++;
- }
- return ans;
- }
- int main()
- {
- int ans=0;
- for(int i=1;i<1e4;++i)
- ans+=(phi(i)>=phi(2*i+1));
- cout<<ans<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement