login
A242118
Number of unit squares that intersect the circumference of a circle of radius n centered at (0,0).
10
0, 4, 12, 20, 28, 28, 44, 52, 60, 68, 68, 84, 92, 92, 108, 108, 124, 124, 140, 148, 148, 164, 172, 180, 188, 180, 196, 212, 220, 220, 228, 244, 252, 260, 260, 268, 284, 284, 300, 300, 308, 316, 332, 340, 348, 348, 364, 372, 380, 388, 380
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).
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
Sequence in context: A285526 A321466 A227226 * A030387 A269931 A043437
KEYWORD
nonn
AUTHOR
Kival Ngaokrajang, May 05 2014
EXTENSIONS
Terms corrected by Orson R. L. Peters, Jan 30 2017
STATUS
approved