#include #include int sq_frac(int x); int N = 10000; int main(int argc, char *argv[]) { int i, c; c = 0; for(i = 1; i <= N; ++i){ if(sq_frac(i) % 2 == 0){ ++c; } } printf("%d\n", c); return 0; } int sq_frac(int x) { int m, n, d, a, c; if((m = sqrt(x)) * m == x){ return 1; } d = c = 1; n = m; do{ d = (x - n * n) / d; a = (n + m) / d; n = a * d - n; ++c; }while(d != 1); return c; }