cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A303706 a(n) is the number of lattice points in a Cartesian grid between an equilateral triangle and an inscribed circle of radius n; one of the side of triangle is perpendicular to the X-axis; the circle's center is at the origin.

Original entry on oeis.org

0, 5, 14, 29, 42, 65, 94, 123, 154, 187, 234, 289, 328, 383, 436, 507, 572, 645, 716, 789, 884, 961, 1058, 1159, 1244, 1347, 1454, 1573, 1692, 1805, 1940, 2057, 2194, 2325, 2454, 2621, 2758, 2927, 3060, 3221, 3404, 3571, 3746, 3909, 4086, 4293, 4478, 4677, 4868, 5061, 5256, 5465, 5698, 5915
Offset: 1

Views

Author

Kirill Ustyantsev, Apr 29 2018

Keywords

Examples

			For n = 2 we have 5 lattice points: (-1, 2); (-1, -2); (2, -1); (2, 1); (3, 0).
		

Crossrefs

Programs

  • PARI
    a(n) = sum(x=-n+1, 2*n, sum(y=-2*n, 2*n, ((x^2+y^2) > n^2) && (3*y^2 < (x-2*n)^2))); \\ Michel Marcus, May 22 2018
  • Python
    import math
    tan=math.sqrt(3)/3
    for n in range (1,71):
      count=0
      for x in range (-n, 2*n):
       for y in range (-2*n, 2*n):
        if (x*x+y*y>n*n and y<-tan*x+2*tan*n and y>tan*x-2*tan*n and x>-n):
         count=count+1
      print(count)