Challenge
The primitive circle problem is the problem of determining how many coprime integer lattice points \$x,y\$ there are in a circle centered at the origin and with radius \$r \in \mathbb{Z}^+ \$ such that \$x^2+y^2 \le r^2 \$. It's a generalization of Code-Golf: Lattice Points inside a Circle.
Input
Radius \$r \in \mathbb{Z}^+\$
Output
Number of coprime points
Test Cases
Taken from sequence A175341 in the OEIS.
Radius | Number of coprime points |
---|---|
0 | 0 |
1 | 4 |
2 | 8 |
3 | 16 |
4 | 32 |
5 | 48 |
5.7
, but the post does not clarify this. \$\endgroup\$