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.

Showing 1-4 of 4 results.

A303642 a(n) is the number of lattice points in Cartesian grid between circle of radius n and its inscribed square. The sides of the square are parallel to coordinate axes.

Original entry on oeis.org

0, 0, 0, 20, 20, 28, 64, 72, 80, 80, 148, 148, 156, 248, 256, 264, 264, 380, 396, 404, 528, 552, 560, 700, 716, 740, 764, 928, 936, 960, 1148, 1180, 1196, 1212, 1440, 1448, 1472, 1700, 1740, 1764, 2000, 2040, 2064, 2104, 2380, 2396, 2428, 2720, 2760, 2784, 2832, 3156
Offset: 1

Views

Author

Kirill Ustyantsev, Apr 27 2018

Keywords

Comments

If the sides of the inscribed square are parallel to bisector of coordinate axes we have a different sequence.

Crossrefs

Programs

  • Python
    import math
    for n in range(1, 100):
     count = 0
     for x in range(0, n):
      for y in range(-n, n):
       if (x * x + y * y < n * n and x > n / math.sqrt(2)):
        count = count + 1
     print(4 * count)

Extensions

Offset corrected by Andrey Zabolotskiy, May 05 2018

A303644 a(n) is the number of lattice points in a Cartesian grid between a square of side length 2*n, centered at the origin, and its inscribed circle. The sides of the square are parallel to the coordinate axes.

Original entry on oeis.org

0, 0, 0, 4, 4, 12, 24, 32, 40, 48, 68, 92, 100, 120, 136, 168, 192, 220, 244, 268, 312, 336, 376, 420, 444, 484, 524, 576, 624, 664, 724, 764, 820, 868, 912, 992, 1040, 1116, 1156, 1220, 1304, 1368, 1440, 1496, 1564, 1660, 1732, 1816, 1888, 1960, 2032, 2116, 2220, 2308
Offset: 1

Views

Author

Kirill Ustyantsev, Apr 27 2018

Keywords

Comments

The borders of the square and the circle are not included. Rotating the square by 45 degrees (so that its vertices lie on the coordinate axes) results in sequence A303646 instead.

Examples

			For n = 4, we have 4 points with integer coordinates; the point in the first quadrant is at (3,3):
.
                    o . . + . . o
                    . . . + . . .
                    . . . + . . .
                   -+-+-+-+-+-+-+-
                    . . . + . . .
                    . . . + . . .
                    o . . + . . o
.
Similarly, for n = 5, we have 4 points with integer coordinates; the point in the first quadrant is at (4,4):
.
                  o . . . + . . . o
                  . . . . + . . . .
                  . . . . + . . . .
                  . . . . + . . . .
                 -+-+-+-+-+-+-+-+-+-
                  . . . . + . . . .
                  . . . . + . . . .
                  . . . . + . . . .
                  o . . . + . . . o
.
For n = 6, we have 12 points, of which the 3 points in the first quadrant are at (4,5), (5,4), and (5,5):
.
                o o . . . + . . . o o
                o . . . . + . . . . o
                . . . . . + . . . . .
                . . . . . + . . . . .
                . . . . . + . . . . .
               -+-+-+-+-+-+-+-+-+-+-+-
                . . . . . + . . . . .
                . . . . . + . . . . .
                . . . . . + . . . . .
                o . . . . + . . . . o
                o o . . . + . . . o o
		

Crossrefs

Programs

  • PARI
    a(n) = sum(x=-n+1, n-1, sum(y=-n+1, n-1, (x^2+y^2) > n^2)); \\ Michel Marcus, May 22 2018
  • Python
    import math
    for n in range(1, 100):
        count = 0
        for x in range(1, n):
            for y in range(1, n):
                if x * x + y * y > n * n and x < n and y < n:
                    count = count + 1
        print(4 * count, end=", ")
    

Formula

a(n) = A016754(n-1) - A000328(n) - 4.

A303646 a(n) is the number of lattice points in a Cartesian grid between a square with integer sides 2*n and its inscribed circle. The sides of the square are parallel to the bisector of coordinate axes.

Original entry on oeis.org

0, 0, 12, 12, 32, 32, 32, 68, 60, 104, 104, 104, 156, 148, 216, 216, 300, 292, 276, 368, 368, 468, 460, 452, 560, 544, 676, 668, 816, 792, 784, 932, 916, 1080, 1048, 1048, 1220, 1212, 1384, 1360, 1352, 1556, 1532, 1736, 1704, 1956, 1924, 1900, 2136, 2096, 2340, 2308
Offset: 1

Views

Author

Kirill Ustyantsev, Apr 27 2018

Keywords

Comments

Rotating the square by 45 degrees (so that its vertices lie on the coordinate axes) results in sequence A303644 instead.

Crossrefs

Programs

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

A303669 a(n) is the number of lattice points in a Cartesian grid between a circle of radius n, centered at the origin, and an inscribed equilateral triangle; one of the sides of triangle is perpendicular to X-axis.

Original entry on oeis.org

0, 2, 13, 21, 36, 56, 81, 103, 144, 166, 215, 239, 298, 342, 405, 447, 514, 568, 655, 707, 796, 864, 961, 1019, 1128, 1208, 1337, 1405, 1524, 1614, 1749, 1847, 1990, 2082, 2249, 2333, 2502, 2600, 2789, 2899, 3064, 3192, 3383, 3519, 3718, 3832, 4047, 4175
Offset: 1

Views

Author

Kirill Ustyantsev, Apr 28 2018

Keywords

Examples

			For n = 2 we have two lattice points between the defined circle and its inscribed equilateral triangle: (1, 1) and (1, -1).
		

Crossrefs

Programs

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