TITLE: The number of grid points near a circle.
QUESTION [8 upvotes]: There is a circle with center $(0, 0)$ and radius $r$. Let $n$ be the number of grid points inside or on the circle that at least one of its neighboring (up, down, left, right) grid points is outside the circle.

With my computer, I got some $r-n$ pairs:
$$
\begin{array}{c|lcr}
r&n\\
\hline
1&4\\
2&8\\
3&16\\
4&20\\
5&28\\
10&56\\
10^2&564\\
10^3&5656\\
10^4&56568\\
10^5&565684\\
10^6&5656852\\
10^7&56568540\\
10^8&565685424\\
10^9&5656854248\\
10^{10}&56568542492\\
\end{array}
$$
And I found that $$\lim_{r\to\infty}\frac nr\approx5.6568542\approx4\sqrt2$$
My question is: how to prove the following equation? $$\lim_{r\to\infty}\frac nr=4\sqrt2$$

REPLY [3 votes]: Here's a slightly different perspective. The $L^\infty$ arc length of the (ordinary) circle of radius $r$ is exactly $(4\sqrt2)r$. So when we define $n$ using a discrete grid, we get the approximation $n=(4\sqrt2)r+O(1)$, and $$\lim_{r\to\infty}\frac{(4\sqrt2)r+O(1)}{r}=4\sqrt2.$$
(This is a suggestive argument, rather than a full proof. I don't know the precise hypotheses we would need to work with more general curves.)