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

A302829 a(n) is the number of lattice points in a Cartesian grid between a circle of radius n and an inscribed square whose vertices lie on the coordinate axes.

Original entry on oeis.org

0, 0, 4, 8, 12, 28, 36, 52, 72, 88, 112, 128, 156, 192, 220, 252, 280, 324, 368, 408, 448, 504, 548, 592, 644, 708, 776, 828, 880, 952, 1016, 1096, 1164, 1236, 1324, 1388, 1472, 1548, 1648, 1736, 1808, 1912, 2004, 2116, 2212, 2300, 2408, 2508, 2624, 2728, 2860, 2976, 3076
Offset: 1

Views

Author

Kirill Ustyantsev, Apr 27 2018

Keywords

Comments

Points are not lying on the borders of the circle and the square.
Note that if the square is rotated so that its sides are parallel to the coordinate axes, the resulting sequence is A303642 instead.

Crossrefs

Programs

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

Formula

a(n) = A281795(n) - 4*A034856(n). - Andrey Zabolotskiy, Apr 29 2018

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)
    				

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)
    
Showing 1-4 of 4 results.