Triangular Lattice Points close to the Origin Background

A triangular grid is a grid formed by tiling the plane regularly with equilateral triangles of side length 1. The picture below is an example of a triangular grid.



A triangular lattice point is a vertex of a triangle forming the triangular grid.

The origin is a fixed point on the plane, which is one of the triangular lattice points.

Challenge

Given a non-negative integer n, find the number of triangular lattice points whose Euclidean distance from the origin is less than or equal to n.

Example

The following figure is an example for n = 7 (showing only 60-degree area for convenience, with point A being the origin):



Test Cases

Input | Output
---------------
    0 |       1
    1 |       7
    2 |      19
    3 |      37
    4 |      61
    5 |      91
    6 |     127
    7 |     187
    8 |     241
    9 |     301
   10 |     367
   11 |     439
   12 |     517
   13 |     613
   14 |     721
   15 |     823
   16 |     931
   17 |    1045
   18 |    1165
   19 |    1303
   20 |    1459
   40 |    5815
   60 |   13057
   80 |   23233
  100 |   36295
  200 |  145051
  500 |  906901
 1000 | 3627559


Hint: This sequence is not OEIS A003215.

Rules

Standard rules for code-golf apply. The shortest submission wins.

Please include how you solved the challenge in your submission.
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.