A303644 a(n) is the number of lattice points in a Cartesian grid between a square of side length 2*n, centered at the origin, and its inscribed circle. The sides of the square are parallel to the coordinate axes.
0, 0, 0, 4, 4, 12, 24, 32, 40, 48, 68, 92, 100, 120, 136, 168, 192, 220, 244, 268, 312, 336, 376, 420, 444, 484, 524, 576, 624, 664, 724, 764, 820, 868, 912, 992, 1040, 1116, 1156, 1220, 1304, 1368, 1440, 1496, 1564, 1660, 1732, 1816, 1888, 1960, 2032, 2116, 2220, 2308
Offset: 1
Keywords
Examples
For n = 4, we have 4 points with integer coordinates; the point in the first quadrant is at (3,3): . o . . + . . o . . . + . . . . . . + . . . -+-+-+-+-+-+-+- . . . + . . . . . . + . . . o . . + . . o . Similarly, for n = 5, we have 4 points with integer coordinates; the point in the first quadrant is at (4,4): . o . . . + . . . o . . . . + . . . . . . . . + . . . . . . . . + . . . . -+-+-+-+-+-+-+-+-+- . . . . + . . . . . . . . + . . . . . . . . + . . . . o . . . + . . . o . For n = 6, we have 12 points, of which the 3 points in the first quadrant are at (4,5), (5,4), and (5,5): . o o . . . + . . . o o o . . . . + . . . . o . . . . . + . . . . . . . . . . + . . . . . . . . . . + . . . . . -+-+-+-+-+-+-+-+-+-+-+- . . . . . + . . . . . . . . . . + . . . . . . . . . . + . . . . . o . . . . + . . . . o o o . . . + . . . o o
Links
- Kirill Ustyantsev, illustrated example
Programs
-
PARI
a(n) = sum(x=-n+1, n-1, sum(y=-n+1, n-1, (x^2+y^2) > n^2)); \\ Michel Marcus, May 22 2018
-
Python
import math for n in range(1, 100): count = 0 for x in range(1, n): for y in range(1, n): if x * x + y * y > n * n and x < n and y < n: count = count + 1 print(4 * count, end=", ")
Comments