Triangular Lattice Points close to the Origin
Python 2, 43 bytes



f=lambda n,a=1:n*n&lt;a/3or n*n/a*6-f(n,a+a%3)


Try it online!

This is black magic. 

Offering 250 rep for a written-up proof. See Lynn's answer for a proof and explanation.