Can you explain the solution of this geometric problem

A year ago IBM research posted an interesting geometrical problem:

A gardener plants a tree on every integer lattice point, except the origin, inside a circle with a radius of $9801$. The trees are cylindrical in shape and all grow together at the same rate. As the trees grow, more and more points outside the circle of trees stop having a direct line of sight with the origin. What will be the trees' radius when the origin first loses its line of sight with all the points outside the circle? Please give your answer as a decimal number with an accuracy of $13$ digits ($13$ significant digits). Here is a sketch of a forest of radius $5$ and a light beam entering the origin (center of the forest). http://domino.research.ibm.com/comm/wwwr_ponder.nsf/challenges/November2012.html

I think I know how to solve it using a computer program, but that's not what I want. Basically, I want a "pure reasoning" solution. I spent a couple of days trying to solve this problem and eventually I took a look at the solution. The problem is I didn't get it. Actually I still don't get it. Could anyone baby step me through it?

The solution:

The answer is $\dfrac{1}{\sqrt{(d)}}$, where $d$ is the smallest integer satisfying $d=a^2+b^2$, where $a$ is co-prime to $b$, and $d\ge R^2$.

Clearly, $d\le R^2+1$ by choosing $a=R$ and $b=1$; and $d$ can be $R^2$ if and only if all the prime factors of $R$ are $1\ \mathrm{modulo} \ 4$. In our case, $R=9801=3^4*11^2$, so the critical radius is $\dfrac{1}{\sqrt{(R^2+1)}}$ which is $0.000102030404529629...$

Thanks.