OFFSET
0,2
COMMENTS
For the points that form the Pythagorean triple (for example see illustration n = 5, on the first quadrant at coordinate (4,3) and (3,4)), the transit of circumference occurs exactly at the corners, therefore there are no additional intersecting squares on the upper or lower rows (diagonally NE & SW directions) of such points.
If the center of the circle is instead chosen at the middle of a square grid centered at (1/2,0), the sequence will be 2*A004767(n-1).
LINKS
Kival Ngaokrajang, Illustration of initial terms
FORMULA
a(n) = 4*Sum{k=1..n} ceiling(sqrt(n^2 - (k-1)^2)) - floor(sqrt(n^2 - k^2)). - Orson R. L. Peters, Jan 30 2017
a(n) = 8*n - A046109(n) for n > 0. - conjectured by Orson R. L. Peters, Jan 30 2017, proved by Andrey Zabolotskiy, Jan 31 2017
PROG
(Python)
a = lambda n: sum(4 for x in range(n) for y in range(n)
if x**2 + y**2 < n**2 and (x+1)**2 + (y+1)**2 > n**2)
(Python)
from sympy import factorint
def a(n):
r = 1
for p, e in factorint(n).items():
if p%4 == 1: r *= 2*e + 1
return 8*n - 4*r if n > 0 else 0
CROSSREFS
KEYWORD
nonn
AUTHOR
Kival Ngaokrajang, May 05 2014
EXTENSIONS
Terms corrected by Orson R. L. Peters, Jan 30 2017
STATUS
approved