#include int main() { long long unsigned int o,i,startat; long long unsigned int tilecount; long long unsigned int sum=0; unsigned short L[1000000]; for (i = 0; i < 1000000; i++) { L[i] = 0; } for (o = 3; o < 260000; o++) { startat = 2 - (o % 2); for (i = startat; i < (o - 1); i+=2) { tilecount = (o * o) - (i * i); if (tilecount <= 1000000 && tilecount > 0) { L[tilecount-1] = L[tilecount-1] + 1; } } if (o % 10000 == 0) printf("On %u\n",o); } long long unsigned int nsum = 0; for (i = 0; i < 1000000; i++) { if (L[i] <= 10 && L[i] >= 1) { sum++; } else if (L[i] == 15) { nsum++; } } printf("N[15] = %llu\n",nsum); printf("Sum 1 <= n <= 10: %llu\n",sum); }