We have an ellipse or a circle:
How many integer pair points (points with coordinate (x,y) where both x and y are integers) can be found inside this ellipse?
Example with a circle (special form of an ellipse):
R=1 points=1 (0,0)
R=2 points=5 (0,0) (1,0) (0,1) (-1,0) (0,-1)
R=3 points=9 ...
Would like to have a generic function with visualization which takes in variables for the Ellipse: (h,k) and radius r1, r2 and circle (h,k) and r.
I am getting 14 for the ellipse here:
Count[Flatten[Table[{x, y}, {x, 0, 4}, {y, 0, 5}],
1], {x_, y_} /; (1/3.5)*(x - 1.8)^2 + (1/6.1)*(y - 2.3)^2 < 1]
14
Although this goes up on the first quadrant, but the shape size and hence the points stay intact! Note the ranges used are maximum that surround the shape. In fact it will not matter the range used as the condition will sandwich it at the end with the same answer. As long as the range is greater than the shape edges.
Thanks
{h,k},r1,r2
. $\endgroup$Solve[(1/3.5)*(x - 1.8)^2 + (1/6.1)*(y - 2.3)^2 < 1 // Rationalize, {x, y}, Integers] // Length
$\endgroup$