34
2
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.



7OEIS A053416 is the sequence of the number of points contained in a circle of diameter rather than radius
n, so has twice as many terms as you want. – Neil – 2018-04-29T10:18:20.853Relevant Wikipedia and Mathworld. Contains xnor's formula and not proof.
– user202729 – 2018-04-30T02:23:07.7274
It is the sum of the first
– alephalpha – 2018-05-01T03:55:18.927n^2+1terms of OEIS A004016.