Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int x = 2, n, i, S = 0, copie, m;
- cin >> n;
- copie = (n * (n + 1)) / 2;
- cout << copie << " ";
- for(i = 2; i < n - 1; i++){
- S = 1;
- m = 1;
- m = m + x;
- while( m != 1 ){
- S += m;
- m += x;
- if( m > n ){
- m = m - n;
- }
- }
- x++;
- if( S < copie ){
- cout << S << " ";
- copie = S;
- }
- }
- cout << 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement