Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- long long int n;
- set<long long int>s;
- void checker(int i)
- {
- long long int k=1,total=0;
- do{
- total+=k;
- k+=i;
- if(k>n)
- k-=n;
- }while(k!=1);
- s.insert(total);
- }
- int main()
- {
- cin>>n;
- long long int i;
- for(i=1;i<=n;i++){
- checker(i);
- }
- for(auto it=s.begin();it!=s.end();it++)
- cout<<*it<<" ";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement