Find the smallest positive integer \(a\) greater than 1000, such that the equation \(\sqrt{a - \sqrt{a + x}} = x\) has a rational root.

a=1001; x =1;b=sqrt(a - sqrt(a + x));printb,x,a;x++;if(x<1000, goto2, 0)

a =1001, x = 599, rational root =31

If the rational root must = x, then this the accurate solution:

a=1000; x=1; b = sqrt(a - sqrt(a + x));if(b==x, goto loop,0);x++;if(x<1000, goto2, 0);a=a+1;x=1;if(a<2000, goto2,0);loop: printb, x, a

Where a =1,057, x =32, and the rational root =32