#include <stdio.h> #define N 13 #define A(u,v,w) (a[u][v]-w)*(a[u][v]-w) int main() { int a[N + 1][2] = {0}, d[(N * N + N) / 2] = {0}; int i = 0, j = 0, k = 0, l = 0, n = 0, s = 0, t = 0; for (n = 1; n <= N; n++) { unsigned long c[N + 1] = {0}; s = 0; for (i = 0; i < n; i++) { j = -1; NEXT: for (j++; j < n; j++) { t = (s * s - s) / 2; for (k = 0; k < s; k++) { for (l = 0; l < t; l++) if (A(k, 0, i) + A(k, 1, j) == d[l]) goto NEXT; for (l = k + 1; l < s; l++) if (A(k, 0, i) + A(k, 1, j) == A(l, 0, i) + A(l, 1, j)) goto NEXT; } a[s][0] = i; a[s][1] = j; for (k = 0; k < s; k++) d[t + k] = A(k, 0, i) + A(k, 1, j); c[++s]++; } } if (s-- != 0) { i = a[s][0]; j = a[s][1]; goto NEXT; } printf("n = %d\n", n); for (i = 1; i <= n; i++) printf("\tc[%d] = %lu\n", i, c[i]); printf("\n"); } return 0; }