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 45 results. Next

A093836 Numerator of A000328(n)/n^2, where A000328(n) is the number of lattice points (x,y) with x^2 + y^2 <= n^2.

Original entry on oeis.org

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

Views

Author

Eric W. Weisstein, Apr 17 2004

Keywords

Comments

First differs from A000328 at n=12: A000328(12) = 441, a(12) = 49.

Crossrefs

Cf. A093837 (denominators), A000328, A093832.

Programs

  • Maple
    N:= 100: # to get a(1) to a(N)
    B:= Array(1..N);
    for i from 0 to N do
      for j from i while i^2 + j^2 <= N^2 do
         v:= ceil(sqrt(i^2+j^2));
         if [i,j] = [0,0] then m:= 1; v:= 1
         elif i=0 or i=j then m:= 4
         else m:= 8
         fi;
         B[v]:= B[v]+m;
      od
    od:
    A000328:= ListTools:-PartialSums(convert(B,list)):
    seq(numer(A000328[n]/n^2),n=1..N); # Robert Israel, May 28 2015

Extensions

Definition edited by Robert Israel, May 28 2015

A381018 a(n) is the number of primes in A000328 for r <= n.

Original entry on oeis.org

1, 2, 3, 3, 3, 4, 5, 6, 6, 7, 7, 7, 7, 8, 9, 10, 10, 11, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 15, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 22, 22, 22, 22, 22, 22, 23, 23, 23
Offset: 1

Views

Author

Michel Marcus, Feb 12 2025

Keywords

Comments

Number of Gauss circle primes for r <= n.

Crossrefs

Programs

  • PARI
    a(n) = sum(k=0, n, isprime(1 + 4*sum(j=0, k^2\4, k^2\(4*j+1) - k^2\(4*j+3))));
    
  • Python
    from math import isqrt
    from sympy import isprime
    def A381018(n): return sum(1 for m in range(1,n+1) if isprime(1+(sum(isqrt(k*((m<<1)-k)) for k in range(1,m+1))<<2))) # Chai Wah Wu, Feb 13 2025

A381017 Prime terms of A000328.

Original entry on oeis.org

5, 13, 29, 113, 149, 197, 317, 613, 709, 797, 1009, 1129, 1373, 3001, 3209, 3853, 4513, 5261, 6361, 7213, 11681, 12853, 15373, 16729, 19577, 20593, 21101, 22133, 25997, 30757, 33317, 38669, 53077, 56401, 65101, 68777, 72533, 73517, 95093, 100621, 108637, 114553, 115781, 118213
Offset: 1

Views

Author

Michel Marcus, Feb 12 2025

Keywords

Comments

Called Gauss circle primes by Ehrenborg.

Crossrefs

Programs

  • Maple
    N:= 200: # for terms in A000328(1..N)
    V:= Array(0..N): V[0]:= 1:
    for x from 1 to N do
      for y from 0 to x do
        if y = 0 or y = x then m:= 4 else m:= 8 fi;
        s:= ceil(sqrt(x^2+y^2));
        if s > N then break fi;
        V[s]:= V[s] + m
    od od:
    select(isprime, ListTools:-PartialSums(convert(V,list))); # Robert Israel, May 27 2025
  • PARI
    select(isprime, vector(200, n, 1 + 4*sum(j=0, n^2\4, n^2\(4*j+1) - n^2\(4*j+3))))

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)

A057655 The circle problem: number of points (x,y) in square lattice with x^2 + y^2 <= n.

Original entry on oeis.org

1, 5, 9, 9, 13, 21, 21, 21, 25, 29, 37, 37, 37, 45, 45, 45, 49, 57, 61, 61, 69, 69, 69, 69, 69, 81, 89, 89, 89, 97, 97, 97, 101, 101, 109, 109, 113, 121, 121, 121, 129, 137, 137, 137, 137, 145, 145, 145, 145, 149, 161, 161, 169, 177, 177, 177
Offset: 0

Views

Author

N. J. A. Sloane, Oct 15 2000

Keywords

Examples

			a(0) = 1 (counting origin).
a(1) = 5 since 4 points lie on the circle of radius sqrt(1) + origin.
a(2) = 9 since 4 lattice points lie on the circle w/radius = sqrt(2) (along diagonals) + 4 points inside the circle + origin. - _Wesley Ivan Hurt_, Jan 10 2013
		

References

  • C. Alsina and R. B. Nelsen, Charming Proofs: A Journey Into Elegant Mathematics, Math. Assoc. Amer., 2010, p. 42.
  • J. H. Conway and N. J. A. Sloane, "Sphere Packings, Lattices and Groups", Springer-Verlag, p. 106.
  • F. Fricker, Einfuehrung in die Gitterpunktlehre, Birkhäuser, Boston, 1982.
  • P. de la Harpe, Topics in Geometric Group Theory, Univ. Chicago Press, 2000, p. 5.
  • E. Kraetzel, Lattice Points, Kluwer, Dordrecht, 1988.
  • C. D. Olds, A. Lax and G. P. Davidoff, The Geometry of Numbers, Math. Assoc. Amer., 2000, p. 51.
  • W. Sierpiński, Elementary Theory of Numbers, Elsevier, North-Holland, 1988.
  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, pages 245-246.

Crossrefs

Partial sums of A004018. Cf. A014198, A057656, A057961, A057962, A122510. For another version see A000328.
Cf. A038589 (for hexagonal lattice).

Programs

  • Haskell
    a057655 n = length [(x,y) | x <- [-n..n], y <- [-n..n], x^2 + y^2 <= n]
    -- Reinhard Zumkeller, Jan 23 2012
    
  • Maple
    N:= 1000: # to get a(0) to a(N)
    R:= Array(0..N):
    for a from 0 to floor(sqrt(N)) do
      for b from 0 to floor(sqrt(N-a^2)) do
        r:= a^2 + b^2;
        R[r]:= R[r] + (2 - charfcn[0](a))*(2 - charfcn[0](b));
      od
    od:
    convert(map(round,Statistics:-CumulativeSum(R)),list); # Robert Israel, Sep 29 2014
  • Mathematica
    f[n_] := 1 + 4Sum[ Floor@ Sqrt[n - k^2], {k, 0, Sqrt[n]}]; Table[ f[n], {n, 0, 60}] (* Robert G. Wilson v, Jun 16 2006 *)
    Accumulate[ SquaresR[2, Range[0, 55]]] (* Jean-François Alcover, Feb 24 2012 *)
    CoefficientList[Series[EllipticTheta[3,0,x]^2/(1-x), {x, 0, 100}], x] (* Vaclav Kotesovec, Sep 29 2014 after Robert Israel *)
  • PARI
    a(n)=sum(x=-n,n,sum(y=-n,n,if((sign(x^2+y^2-n)+1)*sign(x^2+y^2-n),0,1)))
    
  • PARI
    a(n)=1+4*sum(k=0,sqrtint(n), sqrtint(n-k^2) ); /* Benoit Cloitre, Oct 08 2012 */
    
  • Python
    from math import isqrt
    def A057655(n): return 1+(sum(isqrt(n-k**2) for k in range(isqrt(n)+1))<<2) # Chai Wah Wu, Jul 31 2023

Formula

a(n) = 1 + 4*{ [n/1] - [n/3] + [n/5] - [n/7] + ... }. - Gauss
a(n) = 1 + 4*Sum_{ k = 0 .. [sqrt(n)] } [ sqrt(n-k^2) ]. - Liouville (?)
a(n) - Pi*n = O(sqrt(n)) (Gauss). a(n) - Pi*n = O(n^c), c = 23/73 + epsilon ~ 0.3151 (Huxley). If a(n) - Pi*n = O(n^c) then c > 1/4 (Landau, Hardy). It is conjectured that a(n) - Pi*n = O(n^(1/4 + epsilon)) for all epsilon > 0.
a(n) = A014198(n) + 1.
a(n) = A122510(2,n). - R. J. Mathar, Apr 21 2010
a(n) = 1 + sum((floor(1/(k+1)) + 4 * floor(cos(Pi * sqrt(k))^2) - 4 * floor(cos(Pi * sqrt(k/2))^2) + 8 * sum((floor(cos(Pi * sqrt(i))^2) * floor(cos(Pi * sqrt(k-i))^2)), i = 1..floor(k/2))), k = 1..n). - Wesley Ivan Hurt, Jan 10 2013
G.f.: theta_3(0,x)^2/(1-x) where theta_3 is a Jacobi theta function. - Robert Israel, Sep 29 2014
a(n^2) = A000328(n). - R. J. Mathar, Aug 03 2025

A302997 Square array A(n,k), n >= 0, k >= 0, read by antidiagonals: A(n,k) = [x^(n^2)] theta_3(x)^k/(1 - x), where theta_3() is the Jacobi theta function.

Original entry on oeis.org

1, 1, 1, 1, 3, 1, 1, 5, 5, 1, 1, 7, 13, 7, 1, 1, 9, 33, 29, 9, 1, 1, 11, 89, 123, 49, 11, 1, 1, 13, 221, 425, 257, 81, 13, 1, 1, 15, 485, 1343, 1281, 515, 113, 15, 1, 1, 17, 953, 4197, 5913, 3121, 925, 149, 17, 1, 1, 19, 1713, 12435, 23793, 16875, 6577, 1419, 197, 19, 1, 1, 21, 2869, 33809, 88273, 84769, 42205, 11833, 2109, 253, 21, 1
Offset: 0

Views

Author

Ilya Gutkovskiy, Apr 17 2018

Keywords

Comments

A(n,k) is the number of integer lattice points inside the k-dimensional hypersphere of radius n.

Examples

			Square array begins:
  1,   1,   1,    1,     1,      1,  ...
  1,   3,   5,    7,     9,     11,  ...
  1,   5,  13,   33,    89,    221,  ...
  1,   7,  29,  123,   425,   1343,  ...
  1,   9,  49,  257,  1281,   5913,  ...
  1,  11,  81,  515,  3121,  16875,  ...
		

Crossrefs

Programs

  • Mathematica
    Table[Function[k, SeriesCoefficient[EllipticTheta[3, 0, x]^k/(1 - x), {x, 0, n^2}]][j - n], {j, 0, 11}, {n, 0, j}] // Flatten
    Table[Function[k, SeriesCoefficient[1/(1 - x) Sum[x^i^2, {i, -n, n}]^k, {x, 0, n^2}]][j - n], {j, 0, 11}, {n, 0, j}] // Flatten
  • PARI
    T(n,k)={if(k==0, 1, polcoef(((1 + 2*sum(j=1, n, x^(j^2)) + O(x*x^(n^2)))^k)/(1-x), n^2))} \\ Andrew Howroyd, Sep 14 2019

Formula

A(n,k) = [x^(n^2)] (1/(1 - x))*(Sum_{j=-infinity..infinity} x^(j^2))^k.

A305575 List points (x,y) having integer coordinates, sorted first by radial coordinate r and in case of ties, by polar angle 0 <= phi < 2*Pi in a polar coordinate system. Sequence gives x-coordinates.

Original entry on oeis.org

0, 1, 0, -1, 0, 1, -1, -1, 1, 2, 0, -2, 0, 2, 1, -1, -2, -2, -1, 1, 2, 2, -2, -2, 2, 3, 0, -3, 0, 3, 1, -1, -3, -3, -1, 1, 3, 3, 2, -2, -3, -3, -2, 2, 3, 4, 0, -4, 0, 4, 1, -1, -4, -4, -1, 1, 4, 3, -3, -3, 3, 4, 2, -2, -4, -4, -2, 2, 4, 5, 4, 3, 0, -3, -4, -5, -4, -3, 0, 3, 4, 5, 1, -1
Offset: 0

Views

Author

Hugo Pfoertner, Jun 05 2018

Keywords

Comments

Similar to A283307, but with secondary sorting by polar angle.

Examples

			The first points (listing [polar angle phi,x,y]) are:
r^2
  0: [0.0*Pi,0,0];
  1: [0.0*Pi,1,0], [0.5*Pi,0,1], [1.0*Pi,-1,0], [1.5*Pi,0,-1];
  2: [0.25*Pi,1,1], [0.75*Pi,-1,1], [1.25*Pi,-1,-1], [1.75*Pi,1,-1];
  4: [0.0*Pi,2,0], [0.5*Pi,0,2], [1.0*Pi,-2,0], [1.5*Pi,0,-2];
  5: [0.148*Pi,2,1], [0.352*Pi,1,2], [0.648*Pi,-1,2], [0.852*Pi,-2,1],
   [1.148*Pi,-2,-1], [1.352*Pi,-1,-2], [1.648*Pi,1,-2], [1.852*Pi,2,-1];
  8: [0.25*Pi,2,2], [0.75*Pi,-2,2], [1.25*Pi,-2,-2], [1.75*Pi,2,-2].
		

Crossrefs

For the y-coordinates see A305576.

Programs

  • PARI
    atan2(y,x)=if(x>0,atan(y/x),if(x==0,if(y>0,Pi/2,-Pi/2),if(y>=0,atan(y/x)+Pi,atan(y/x)-Pi)));
    angle(x,y)=(atan2(y,x)+2*Pi)%(2*Pi);
    {a004018(n) = if( n<1, n==0, 4 * sumdiv( n, d, (d%4==1) - (d%4==3)))};
    xyselect=1; \\ change to 2 for A305576
    print1(0,", ");for(s=1,25,my(r=a004018(s));if(r>0,my(v=matrix(r,3),w=vector(r),m=sqrtint(s),L=0);for(i=-m,m,my(k=s-i^2,kk);if(k==0,v[L++,1]=i;v[L,2]=0;v[L,3]=angle(i,0),if(issquare(k),kk=sqrtint(k);forstep(j=-kk,kk,kk+kk,v[L++,1]=i;v[L,2]=j;v[L,3]=angle(i,j)))));p=vecsort(v[,3],,1);for(k=1,L,w[k]=v[p[k],xyselect]);for(k=1,L,print1(w[k],", ")))); \\ Hugo Pfoertner, May 12 2019

A305576 List points (x,y) having integer coordinates, sorted first by radial coordinate r and in case of ties, by polar angle 0 <= phi < 2*Pi in a polar coordinate system. Sequence gives y-coordinates.

Original entry on oeis.org

0, 0, 1, 0, -1, 1, 1, -1, -1, 0, 2, 0, -2, 1, 2, 2, 1, -1, -2, -2, -1, 2, 2, -2, -2, 0, 3, 0, -3, 1, 3, 3, 1, -1, -3, -3, -1, 2, 3, 3, 2, -2, -3, -3, -2, 0, 4, 0, -4, 1, 4, 4, 1, -1, -4, -4, -1, 3, 3, -3, -3, 2, 4, 4, 2, -2, -4, -4, -2, 0, 3, 4, 5, 4, 3, 0, -3, -4, -5, -4, -3, 1
Offset: 0

Views

Author

Hugo Pfoertner, Jun 05 2018

Keywords

Comments

Similar to A283308, but with secondary sorting by polar angle.

Examples

			See A305575.
		

Crossrefs

For the x-coordinates see A305575.

Programs

A000603 Number of nonnegative solutions to x^2 + y^2 <= n^2.

Original entry on oeis.org

1, 3, 6, 11, 17, 26, 35, 45, 58, 73, 90, 106, 123, 146, 168, 193, 216, 243, 271, 302, 335, 365, 402, 437, 473, 516, 557, 600, 642, 687, 736, 782, 835, 886, 941, 999, 1050, 1111, 1167, 1234, 1297, 1357, 1424, 1491, 1564, 1636, 1703, 1778, 1852, 1931, 2012, 2095
Offset: 0

Views

Author

Keywords

Comments

Row sums of triangle A255238. - Wolfdieter Lang, Mar 15 2015

References

  • H. Gupta, A Table of Values of N_3(t), Proc. National Institute of Sciences of India, 13 (1947), 35-63.
  • 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 A302998.

Programs

  • Haskell
    a000603 n = length [(x,y) | x <- [0..n], y <- [0..n], x^2 + y^2 <= n^2]
    -- Reinhard Zumkeller, Jan 23 2012
    
  • Mathematica
    Table[cnt = 0; Do[If[x^2 + y^2 <= n^2, cnt++], {x, 0, n}, {y, 0, n}]; cnt, {n, 0, 51}] (* T. D. Noe, Apr 02 2013 *)
    Table[If[n==1,1,2*Sum[Sum[A255195[[n, n - k + 1]], {k, 1, k}], {k, 1, n}] - Ceiling[(n - 1)/Sqrt[2]]],{n,1,52}] (* Mats Granvik, Feb 19 2015 *)
  • PARI
    a(n)=my(n2=n^2);sum(a=0,n,sqrtint(n2-a^2)+1) \\ Charles R Greathouse IV, Apr 03 2013
    
  • Python
    from math import isqrt
    def A000603(n): return (m:=n<<1)+sum(isqrt(k*(m-k)) for k in range(1,n))+1 # Chai Wah Wu, Jul 18 2024

Formula

a(n) = n^2 * Pi/4 + O(n). - Charles R Greathouse IV, Apr 03 2013
a(n) = A001182(n) + 2*n + 1. - R. J. Mathar, Jan 07 2015
a(n) = 2*A026702(n) - (1 + floor(n/sqrt(2))), n >= 0. - Wolfdieter Lang, Mar 15 2015
a(n) = [x^(n^2)] (1 + theta_3(x))^2/(4*(1 - x)), where theta_3() is the Jacobi theta function. - Ilya Gutkovskiy, Apr 15 2018

Extensions

More terms from David W. Wilson, May 22 2000

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
Showing 1-10 of 45 results. Next