Challenge
Determine how many integer lattice points there are in an ellipse
$$\frac{x^2}{a^2} + \frac{y^2}{b^2} \leq 1$$
centered at the origin with width \$2a\$ and height \$2b\$ where integers \$a, b > 0\$ .
Input
The Semi-major \$a\$ and Semi-minor \$b\$ axes.
Output
Number of interior and boundary points.
Example
Ellipse plot showing \$a=5\$ and \$b=3\$ with \$41\$ blue interior and \$4\$ red boundary points.
Input
\$5\$,\$3\$
Output
\$41\$,\$4\$
Test Cases
a | b | Interior | Boundary |
---|---|---|---|
5 | 3 | 41 | 4 |
5 | 15 | 221 | 12 |
8 | 5 | 119 | 4 |
8 | 1 | 15 | 4 |
9 | 15 | 417 | 4 |
15 | 15 | 697 | 12 |
20 | 20 | 1245 | 12 |