Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- int main()
- {
- int d, x, y, sx, sy, fx, fy, max = 0;
- for (d=100; d<=1000; d++)
- {
- if (sqrtf(d) == (int)sqrtf(d)) continue;
- for (x=1, sx=1;; x++)
- {
- sx = x*x;
- for (y=1, sy=1; sx > d*sy+1; y++)
- {
- sy = y*y;
- if (sx - d*sy == 1) break;
- }
- if (sx - d*sy == 1)
- {
- fx = x, fy = y;
- if (fx > max) max = fx;
- printf("%d^2 - %d*%d^2 = 1\n",fx,d,fy);
- break;
- }
- }
- }
- printf("max=%d\n",max);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement