#include <stdio.h>
#include <iostream>

using namespace std;

int main() {
	int n;
	int a[10000];
	int kari;
	while (cin >> n) {
		if (n == 0) {
			break;
		}
		int b[10000] = {0};
		int counter[10000] = {0};
		for (int i = 0; i < n-1; i++) {
			a[i] = (i+1) * (i+1) % n;
		}
		for (int i = 0; i < n-1; i++) {
			b[a[i]] = 1; 
		}
		for (int i = 0; i < n-1; i++) {
			for (int j = 0; j < n-1; j++) {
				if (b[i] == 1 && b[j] == 1 && i+1 != j+1) {
					kari = i - j;
					if (kari < 0) {
						kari += n;
					}
					if (kari > (n-1) / 2) {
						kari = n - kari;
					}
					counter[kari]++;
				}
			}
		}
		for (int i = 0; i < n-1; i++) {
			if (counter[i] != 0) {
				cout << counter[i] << endl;
			}
		}
	}
	return 0;
}