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-10 of 10 results.

A000328 Number of points of norm <= n^2 in square lattice.

Original entry on oeis.org

1, 5, 13, 29, 49, 81, 113, 149, 197, 253, 317, 377, 441, 529, 613, 709, 797, 901, 1009, 1129, 1257, 1373, 1517, 1653, 1793, 1961, 2121, 2289, 2453, 2629, 2821, 3001, 3209, 3409, 3625, 3853, 4053, 4293, 4513, 4777, 5025, 5261, 5525, 5789, 6077, 6361, 6625
Offset: 0

Views

Author

Keywords

Comments

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

References

  • J. H. Conway and N. J. A. Sloane, "Sphere Packings, Lattices and Groups", Springer-Verlag, p. 106.
  • H. Gupta, A Table of Values of N_3(t), Proc. National Institute of Sciences of India, 13 (1947), 35-63.
  • C. D. Olds, A. Lax and G. P. Davidoff, The Geometry of Numbers, Math. Assoc. Amer., 2000, p. 47.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Column k=2 of A302997.
Equals A051132 + A046109. For another version see A057655.

Programs

  • Haskell
    a000328 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}], {n, 0, 46}]
  • PARI
    { a(n) = 1 + 4 * sum(j=0,n^2\4, n^2\(4*j+1) - n^2\(4*j+3) ) } /* Max Alekseyev, Nov 18 2007 */
    
  • Python
    def A000328(n):
        return (sum([int((n**2 - y**2)**0.5) for y in range(1, n)]) * 4 + 4*n + 1)
        # Karl-Heinz Hofmann, Aug 03 2022
    
  • Python
    from math import isqrt
    def A000328(n): return 1+(sum(isqrt(k*((n<<1)-k)) for k in range(1,n+1))<<2) # Chai Wah Wu, Feb 12 2025

Formula

a(n) = 1 + 4 * Sum_{j>=0} floor(n^2/(4*j+1)) - floor(n^2/(4*j+3)). Also a(n) = A057655(n^2). - Max Alekseyev, Nov 18 2007
a(n) = 4*A000603(n) - (4*n+3), n >= 0. - Wolfdieter Lang, Mar 15 2015
a(n) = 1+4*n^2-4*ceiling((n-1)/sqrt(2))-8*A247588(n-1), n>1. - Mats Granvik, May 23 2015
a(n) = [x^(n^2)] theta_3(x)^2/(1 - x), where theta_3() is the Jacobi theta function. - Ilya Gutkovskiy, Apr 14 2018
Limit_{n->oo} a(n)/n^2 = Pi. - Chai Wah Wu, Feb 12 2025

Extensions

More terms from David W. Wilson, May 22 2000
Edited at the suggestion of Max Alekseyev by N. J. A. Sloane, Nov 18 2007
Incorrect comment removed by Eric M. Schmidt, May 28 2015

A046109 Number of lattice points (x,y) on the circumference of a circle of radius n with center at (0,0).

Original entry on oeis.org

1, 4, 4, 4, 4, 12, 4, 4, 4, 4, 12, 4, 4, 12, 4, 12, 4, 12, 4, 4, 12, 4, 4, 4, 4, 20, 12, 4, 4, 12, 12, 4, 4, 4, 12, 12, 4, 12, 4, 12, 12, 12, 4, 4, 4, 12, 4, 4, 4, 4, 20, 12, 12, 12, 4, 12, 4, 4, 12, 4, 12, 12, 4, 4, 4, 36, 4, 4, 12, 4, 12, 4, 4, 12, 12, 20, 4, 4, 12, 4, 12, 4, 12, 4, 4, 36
Offset: 0

Views

Author

Keywords

Comments

Also number of Gaussian integers x + yi having absolute value n. - Alonso del Arte, Feb 11 2012
The indices of terms not equaling 4 or 12 correspond to A009177, n>0. - Bill McEachen, Aug 14 2025

Examples

			a(5) = 12 because the circumference of the circle with radius 5 will pass through the twelve points (5, 0), (4, 3), (3, 4), (0, 5), (-3, 4), (-4, 3), (-5, 0), (-4, -3), (-3, -4), (0, -5), (3, -4) and (4, -3). Alternatively, we can say the twelve Gaussian integers 5, 4 + 3i, ... , 4 - 3i all have absolute value of 5.
		

Crossrefs

Programs

  • Haskell
    a046109 n = length [(x,y) | x <- [-n..n], y <- [-n..n], x^2 + y^2 == n^2]
    -- Reinhard Zumkeller, Jan 23 2012
    
  • Maple
    N:= 1000: # to get a(0) to a(N)
    A:= Array(0..N):
    A[0]:= 1:
    for x from 1 to N do
      A[x]:= A[x]+4;
      for y from 1 to min(x-1,floor(sqrt(N^2-x^2))) do
         z:= x^2+y^2;
         if issqr(z) then
           t:= sqrt(z);
           A[t]:= A[t]+8;
         fi
      od
    od:
    seq(A[i],i=0..N); # Robert Israel, May 08 2015
  • Mathematica
    Table[Length[Select[Flatten[Table[r + I i, {r, -n, n}, {i, -n, n}]], Abs[#] == n &]], {n, 0, 49}] (* Alonso del Arte, Feb 11 2012 *)
  • PARI
    a(n)=if(n==0, return(1)); my(f=factor(n)); 4*prod(i=1,#f~, if(f[i,1]%4==1, 2*f[i,2]+1, 1)) \\ Charles R Greathouse IV, Feb 01 2017
    
  • PARI
    a(n)=if(n==0, return(1)); t=0; for(x=1, n-1, y=n^2-x^2; if(issquare(y), t++)); return(4*t+4) \\ Arkadiusz Wesolowski, Nov 14 2017
  • Python
    from sympy import factorint
    def a(n):
        r = 1
        for p, e in factorint(n).items():
            if p%4 == 1: r *= 2*e + 1
        return 4*r if n > 0 else 0
    # Orson R. L. Peters, Jan 31 2017
    

Formula

a(n) = A000328(n) - A051132(n).
a(n) = 8*A046080(n) + 4 for n > 0.
a(n) = A004018(n^2).
From Jean-Christophe Hervé, Dec 01 2013: (Start)
a(A084647(k)) = 28.
a(A084648(k)) = 36.
a(A084649(k)) = 44. (End)
a(n) = 4 * Product_{i=1..k} (2*e_i + 1) for n > 0, given that p_i^e_i is the i-th factor of n with p_i = 1 mod 4. - Orson R. L. Peters, Jan 31 2017
a(n) = [x^(n^2)] theta_3(x)^2, where theta_3() is the Jacobi theta function. - Ilya Gutkovskiy, Apr 20 2018
From Hugo Pfoertner, Sep 21 2023: (Start)
a(n) = 8*A063014(n) - 4 for n > 0.
a(n) = 4*A256452(n) for n > 0. (End)

A291259 Minimum number of points of the square lattice falling strictly inside a circle of radius n.

Original entry on oeis.org

0, 1, 9, 25, 45, 69, 108, 145, 193, 248, 305, 373, 437, 517, 608, 697, 793, 889, 1005, 1124, 1245, 1369, 1510, 1649, 1789, 1941, 2109, 2278, 2449, 2617, 2809, 2997, 3202, 3405, 3613, 3834, 4049, 4281, 4509, 4762, 5013, 5249, 5521, 5785, 6068, 6348, 6621, 6917
Offset: 0

Views

Author

Andres Cicuttin, Aug 21 2017

Keywords

Comments

Due to the symmetry and periodicity of the square lattice it is sufficient to explore possible circles with center belonging to the triangle with vertices (0,0), (1/2,0), and (1/2,1/2).
The different regions for the centers producing constant numbers of lattice points inside circles of radius n seem to become very complex and irregular as n increases (see density plots in Links).

Examples

			From _Arkadiusz Wesolowski_, Dec 18 2017 [Corrected by _Andrey Zabolotskiy_, Feb 19 2018]: (Start)
For a circle centered at the point (x, y) = (1/2, 0) with radius 6, there are 108 lattice points inside the circle.
Possible (but not unique) choices for the centers of the circles for radii up to 20 are given below.
.
.  Poss. center          Points in
.    x      y    Radius  the circle
.  -----  -----  ------  ----------
.    0      0       1         1
.    0      0       2         9
.    0      0       3        25
.    0      0       4        45
.    0      0       5        69
.   1/2     0       6       108
.    0      0       7       145
.    0      0       8       193
.   1/5     0       9       248
.    0      0      10       305
.    0      0      11       373
.    0      0      12       437
.    0      0      13       517
.   1/4     0      14       608
.    0      0      15       697
.    0      0      16       793
.    0      0      17       889
.    0      0      18      1005
.   1/2    1/2     19      1124
.    0      0      20      1245
(End)
		

Crossrefs

Programs

  • Mathematica
    (* A291259: Minimum number of points of the square lattice falling strictly inside a circle of radius n. *)
    (* The three vertices of the Explorative Triangle (ET) *)
    P1={0,0}; P2={1/2,0}; P3={1/2,1/2};
    dd2=SquaredEuclideanDistance;
    (* candidatePointQ[p,n] gives True if "p" is a candidate point, and False otherwise. A candidate point is a point belonging to a circle of radius "n" with center in the ET *)
    candidatePointQ[p_,n_] := With[{dds={dd2[p,P1],dd2[p,P2],dd2[p,P3]}}, Max[dds]>=n^2>=Min[dds]];
    (* Check if point "p" falls inside any circle with radius "n" and center in the ET *)
    innerPointQ[p_,n_] := With[{dds={dd2[p,P1],dd2[p,P2],dd2[p,P3]}}, Max[dds]Andres Cicuttin & Andrey Zabolotskiy, Nov 14 2017 *)

Formula

a(n) ~ Pi*n^2.
a(n) <= A051132(n). - Joerg Arndt, Oct 03 2017

Extensions

More terms from Andrey Zabolotskiy, Nov 17 2017

A077770 Number of ordered pairs of integers (x,y) with n^2 < x^2 + y^2 < (n+1)^2; number of lattice points between circles of radii n and n+1.

Original entry on oeis.org

0, 4, 12, 16, 20, 28, 32, 44, 52, 52, 56, 60, 76, 80, 84, 84, 92, 104, 116, 116, 112, 140, 132, 136, 148, 148, 164, 160, 164, 180, 176, 204, 196, 204, 216, 196, 228, 216, 252, 236, 224, 260, 260, 284, 272, 260, 292, 288, 308, 300, 316, 312, 300, 332, 320, 364
Offset: 0

Views

Author

T. D. Noe, Nov 20 2002

Keywords

Comments

Note that 2*A077768(n)-a(n)/4 is the characteristic sequence for the Beatty sequence A001951(n).

Crossrefs

Programs

  • Mathematica
    Table[Sum[SquaresR[2, k], {k, n^2 + 1, (n + 1)^2 - 1}], {n, 0, 100}]

Formula

a(n) = A051132(n+1) - A000328(n)

A047077 Number of pairs of integers (x,y) with n^2 <= x^2+y^2 <= (n+1)^2.

Original entry on oeis.org

5, 12, 20, 24, 36, 44, 40, 52, 60, 68, 72, 68, 92, 96, 100, 100, 108, 120, 124, 132, 128, 148, 140, 144, 172, 180, 180, 168, 180, 204, 192, 212, 204, 220, 240, 212, 244, 232, 268, 260, 248, 276, 268, 292, 288, 276, 300, 296, 316, 324, 348, 336, 324, 348, 336
Offset: 0

Views

Author

Klaus Strassburger (strass(AT)ddfi.uni-duesseldorf.de), Jan 26 2000

Keywords

Comments

Number of integer Cartesian grid points covered by a ring around the origin with width 1 and outer radius n. Also, number of Gaussian integers z=a+bi satisfying n-1 <= |z| <= n. - Ralf Stephan, Nov 28 2013

Crossrefs

Programs

  • Mathematica
    a[n_] := Sum[SquaresR[2, k], {k, n^2, (n+1)^2}]; Table[a[n], {n, 0, 54}] (* Jean-François Alcover, Oct 15 2012 *)

Formula

a(n) = A000328(n+1) - A051132(n).

A053456 Open disk numbers (version 1): a(n) is the number of points (i,j), i,j, integers, contained in an open disk of diameter n, centered at (0,0).

Original entry on oeis.org

0, 1, 1, 9, 9, 21, 25, 37, 45, 69, 69, 97, 109, 137, 145, 177, 193, 225, 249, 293, 305, 349, 373, 421, 437, 489, 517, 577, 609, 665, 697, 749, 793, 861, 889, 973, 1005, 1085, 1125, 1201, 1245, 1313, 1369, 1457, 1513, 1597, 1649, 1741, 1789, 1885, 1941
Offset: 0

Views

Author

Klaus Strassburger (strass(AT)ddfi.uni-duesseldorf.de), Jan 13 2000

Keywords

Crossrefs

Bisections: A051132, A036704.
Cf. A000796 (Pi).

Formula

a(n)/(n/2)^2->Pi.

A088898 T(n,k) = number of ordered pairs of integers (x,y) with x^2/n^2 + y^2/k^2 < 1, 1<=k<=n; triangular array, read by rows.

Original entry on oeis.org

1, 3, 9, 5, 15, 25, 7, 21, 31, 45, 9, 27, 41, 59, 69, 11, 33, 51, 69, 87, 109, 13, 39, 61, 83, 105, 127, 145, 15, 41, 67, 93, 119, 141, 171, 193, 17, 47, 77, 103, 137, 159, 193, 219, 249, 19, 53, 87, 117, 147, 181, 215, 241, 275, 305, 21, 59, 97, 131, 165, 203
Offset: 1

Views

Author

Reinhard Zumkeller, Oct 21 2003

Keywords

Comments

T(n,k) = number of inner lattice points of an ellipse with semimajor axis = n, semiminor axis = k and center = (0,0).
a(n) = A088897(n) - A088899(n);
T(n,n) = A051132(n).

Programs

  • Mathematica
    T[1, 1] = 1;
    T[n_, k_] := Reduce[x^2/n^2 + y^2/k^2 < 1, {x, y}, Integers] // Length;
    Table[T[n, k], {n, 1, 11}, {k, 1, n}] // Flatten (* Jean-François Alcover, Sep 27 2021 *)

A103225 Number of Gaussian integers z with abs(z) < n and gcd(n,z)=1.

Original entry on oeis.org

1, 4, 24, 24, 44, 48, 144, 96, 224, 96, 372, 192, 444, 304, 404, 392, 792, 448, 1124, 408, 1200, 752, 1648, 808, 1240, 896, 2036, 1200, 2440, 800, 2996, 1600, 3008, 1592, 2404, 1808, 4056, 2256, 3616, 1600, 4992, 2400, 5784, 3008, 3604, 3304, 6916, 3224, 7376
Offset: 1

Views

Author

T. D. Noe, Jan 26 2005

Keywords

Comments

This sequence is much like the usual totient function. That is, it gives the number of Gaussian integers that are relatively prime to n and whose modulus is less than n. When n is a Gaussian prime, A002145, then a(n) = A051132(n)-1.
Four of the dominant lines of the plot appear to align to k(i)*Pi*n^2, with k(i) = 1, 8/9, 1/2, and 4/9. Conjecture: a(n) < Pi*n^2. - Bill McEachen, Aug 14 2025

Examples

			a(2)=4 because 1, -1, i and -i are relatively prime to 2 and have modulus less than 2.
		

Crossrefs

Programs

  • Mathematica
    Table[cnt=0; Do[z=a+ b*I; If[Abs[z]
    				

A387220 Arithmetic mean of number of lattice points strictly inside circle of radius n centered on origin, and number of points not outside that circle.

Original entry on oeis.org

3, 11, 27, 47, 75, 111, 147, 195, 251, 311, 375, 439, 523, 611, 703, 795, 895, 1007, 1127, 1251, 1371, 1515, 1651, 1791, 1951, 2115, 2287, 2451, 2623, 2815, 2999, 3207, 3407, 3619, 3847, 4051, 4287, 4511, 4771, 5019, 5255, 5523, 5787, 6075, 6355, 6623, 6919, 7211
Offset: 1

Views

Author

Lorraine Lee, Aug 22 2025

Keywords

Comments

a(n) is the number of integer values (x, y) strictly inside the circle x^2+y^2=n^2, plus half the number of such lattice points that are part of the perimeter of that circle.
All terms are odd. - Chai Wah Wu, Aug 23 2025

Examples

			The unit circle has 1 lattice point strictly inside it and 5 lattice points not outside it. Halfway between 1 and 5 is 3, so a(1) = 3.
		

Crossrefs

Average of A051132 and A000328.

Programs

  • PARI
    a(n) = {4*n -1 + 2*sum(k=1, n-1, my(t=n^2-k^2); 2*sqrtint(t)-issquare(t))} \\ Andrew Howroyd, Aug 22 2025
    
  • Python
    from math import isqrt
    def A387220(n): return 1+(sum(isqrt(m:=k*((n<<1)-k))+isqrt(m-1) for k in range(1,n+1))<<1) # Chai Wah Wu, Aug 23 2025

Formula

a(n) = (A051132(n) + A000328(n))/2.
a(n) = A256465(n^2). - R. J. Mathar, Aug 26 2025

A304035 a(n) is the number of lattice points inside a square bounded by the lines x=-n/sqrt(2), x=n/sqrt(2), y=-n/sqrt(2), y=n/sqrt(2).

Original entry on oeis.org

1, 9, 25, 25, 49, 81, 81, 121, 169, 225, 225, 289, 361, 361, 441, 529, 625, 625, 729, 841, 841, 961, 1089, 1089, 1225, 1369, 1521, 1521, 1681, 1849, 1849, 2025, 2209, 2401, 2401, 2601, 2809, 2809, 3025, 3249, 3249, 3481, 3721, 3969, 3969, 4225, 4489, 4489, 4761, 5041, 5329, 5329, 5625, 5929, 5929
Offset: 1

Views

Author

Kirill Ustyantsev, May 05 2018

Keywords

Comments

If we calculate the first difference of this sequence and then substitute nonzero numbers as 1, we get exactly A080764.
If we include boundary points of the squares we get same sequence (obviously).
Duplicates appear at 4, 7, 11, 14, 18, 21, 24, 28, 31, 35, 38, 41, 45, 48, 52, 55 (= A083051 ?). - Robert G. Wilson v, Jun 20 2018

Crossrefs

Programs

  • PARI
    a(n) = sum(x=-n, n, sum(y=-n, n, ((2*x^2 < n^2) && (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 (-n, n):
      for y in range (-n, n):
       if ((2*x*x < n*n) and (2*y*y < n*n)):
        count=count+1
     print(count)
    

Formula

a(n) = A051132(n) - A303642(n).
Showing 1-10 of 10 results.