#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
main(){
  int p[10000],c[9999],n;
  r(i,10000)p[i]=i*i;
  while(cin>>n,n){
    memset(c,0,sizeof(c));
    vector<int>v;
    r(i,n-1)v.push_back(p[i+1]%n);
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
    r(i,v.size())r(j,i)if(i!=j){
      int x=v[i]-v[j];
      if(x<0)x+=n;
      else if(x>(n-1)/2)x=n-x;
      c[x]+=2;
    }
    r(i,v.size())cout<<c[i+1]<<endl;
  }
}