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.

A051132 Number of ordered pairs of integers (x,y) with x^2+y^2 < n^2.

Original entry on oeis.org

0, 1, 9, 25, 45, 69, 109, 145, 193, 249, 305, 373, 437, 517, 609, 697, 793, 889, 1005, 1125, 1245, 1369, 1513, 1649, 1789, 1941, 2109, 2285, 2449, 2617, 2809, 2997, 3205, 3405, 3613, 3841, 4049, 4281, 4509, 4765, 5013, 5249, 5521, 5785, 6073, 6349, 6621
Offset: 0

Views

Author

Jostein Trondal (jostein.trondal(AT)protech.no)

Keywords

Examples

			a(3)=25 from the points of shapes 00 (1), 10 (4), 11 (4), 20 (4), 21 (8), 22 (4).
		

Crossrefs

Changing "<" to "<=" in the definition gives A000328.

Programs

  • Haskell
    a051132 n = length [(x,y) | x <- [-n..n], y <- [-n..n], x^2 + y^2 < n^2]
    -- Reinhard Zumkeller, Jan 23 2012
    
  • Mathematica
    Table[Sum[SquaresR[2, k], {k, 0, n^2 - 1}], {n, 0, 46}]
    a[0]=0;a[n_]:=4*n-3+4Sum[Ceiling[Sqrt[n^2-i^2]]-1,{i,n-1}];Array[a,47,0] (* Giorgos Kalogeropoulos, May 20 2025 *)
  • Python
    from math import isqrt
    def A051132(n): return 1+(sum(isqrt(k*((n<<1)-k)-1) for k in range(1,n+1))<<2) if n else 0 # Chai Wah Wu, Feb 12 2025

Formula

a(n) = A000328(n) - A046109(n). - Reinhard Zumkeller, Jan 23 2012
Limit_{n->oo} a(n)/n^2 = Pi. - Chai Wah Wu, Feb 12 2025
a(n) = 4*n - 3 + 4 Sum_{i=1..n-1} ceiling(sqrt(n^2 - i^2)) - 1, for n > 0 (see Zhao). - Giorgos Kalogeropoulos, May 20 2025

Extensions

More terms from James Sellers