#define _USE_MATH_DEFINES
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <iterator>
 
using namespace std;
 
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
 
#define FOR(i,n) for(int i = 0; i < (n); i++)
#define sz(c) ((int)c.size())

typedef unsigned long long ull;

int main(){
	int n; 
	while(cin>>n,n){
		vector<int> v(n-1);
		FOR(i,n-1){
			v[i] = (i+1)*(i+1) % n;
		}
		sort(v.begin(),v.end());
		v.erase(unique(v.begin(),v.end()),v.end());

		int n12 = (n-1)/2;
		vector<int> ans(n12+1);
		FOR(i,sz(v)) for(int j = i+1; j < sz(v); j++){
			int df = v[j]-v[i];
			if(df > n12) df = n - df;
			ans[df]++;
		}

		for(int i = 1; i < sz(ans); i++){
			cout << ans[i] * 2<< endl;
		}
	}
	return 0;
}