Gauss's Circle Problem

Author

Eric W. Weisstein
September 6, 2008

This notebook downloaded from http://mathworld.wolfram.com/notebooks/NumberTheory/GausssCircleProblem.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/GausssCircleProblem.html.

©2008 Wolfram Research, Inc. except for portions noted otherwise

Figure

GaussCircle[r_]:={
{GrayLevel[.7],Disk[{0,0},r]},
PointSize[.02],
Map[Point,Table[{x,y},{x,-r,r},{y,-r,r}],{2}],
PointSize[.045],
Map[Point,Table[{x,y},{x,-r,r},{y,-Floor[Sqrt[r^2-x^2]],Floor[Sqrt[r^2-x^2]]}],{2}],
Line[{{-r,0},{r,0}}],Line[{{0,-r},{0,r}}]
}

Show[GraphicsArray[Graphics[#,AspectRatio->Automatic]&/@GaussCircle/@Range[3]]]

Values

4 (∑_i^(⌊r⌋))⌊(Sqrt[(r^2)-(i^2)])⌋+4 ⌊r⌋+1

Sum[Floor[Sqrt[r^2-i^2]],{i,Floor[r]}]

Table[1+4Floor[r]+4Sum[Floor[Sqrt[r^2-i^2]],{i,Floor[r]}],{r,0,10}]

4 (∑_i^(r^2))(((-1))^(i-1)) ⌊((r^2)/(2 i-1))⌋+1

Table[1+4Sum[(((-1))^(i-1))Floor[((r^2)/(2i-1))],{i,r^2}],{r,0,10}]

1+4Sum[(((-1))^(i-1))Floor[((r^2)/(2i-1))],{i,r^2}]

(∑_(n=0)^(r^2))(SquaresR[2, n])

Sum[SquaresR[2,n],{n,0,r^2}]

Table[Sum[SquaresR[2,n],{n,0,r^2}],{r,0,10}]

4 (∑_(j=0)^∞)(⌊((r^2)/(4 j+1))⌋-⌊((r^2)/(4 j+3))⌋)+1

Table[1+4Sum[Floor[((n^2)/(4j+1))]-Floor[((n^2)/(4j+3))],{j,0,∞}],{n,0,10}]

1+4Sum[Floor[((n^2)/(4j+1))]-Floor[((n^2)/(4j+3))],{j,0,∞}]

Leibniz Series

(Table[Sum[SquaresR[2,n],{n,0,r^2}],{r,0,10}]-1)/4

Table[(-1)^(n-1)/(2n-1),{n,5}]

Sum[SquaresR[2,n],{n,0,r^2}]

V6

FullSimplify[Sum[(-1)^(n-1)/(2n-1),{n,r}],r∈Integers&&Mod[r,2]==1]

FunctionExpand[%]

Table[(1/4) (π-PolyGamma[0,(1/4)+(r/2)]+PolyGamma[0,(3/4)+(r/2)]),{r,1,15,2}]//FunctionExpand

Table[Sum[SquaresR[2,n],{n,0,r^2}],{r,0,10}]

V7

FullSimplify[Sum[(-1)^(n-1)/(2n-1),{n,r}],r∈Integers&&Mod[r,2]==1]

FunctionExpand[%,r>0]

FullSimplify[%,r>0]

Limit[%,r->∞]

Plots

<<Utilities`Plot`
<<Utilities`Typesetting`

ListPlot[rs,
Joined->True,PlotStyle->Red,Epilog->{Blue,Line[{{0,Pi},{300,Pi}}]},AxesLabel->{r,ylabel}]

ListPlot[Pi-rs,Joined->True,PlotStyle->Red,PlotRange->{-1,1}.0005]

V5

r=Table[SumOfSquaresR[2,n],{n,2500^2}];//Timing

r=Table[SumOfSquaresR[2,n],{n,3000^2}];//Timing

r=Table[SumOfSquaresR[2,n],{n,4000^2}];//Timing

...runs out of memory...

Slow

rs=Table[Sum[SumOfSquaresR[2,n],{n,0,r^2}]/r^2,{r,0,300}];//Timing

Fast

rr=FoldList[Plus,1,Plus@@@Table[Take[r,{1+n^2,(n+1)^2}],{n,0,2999}]];//Timing

rs=MapIndexed[#1/(#2[[1]]-1)^2&,rr];//Timing

Take[rs,10]

MakeBoxes[ylabel,TraditionalForm]:=RowBox[{RowBox[{"N","(","r",")"}],"/",SuperscriptBox["r","2"]}]

Position[rs-Pi,_?Positive,1]//Flatten

Position[rs-Pi,_?Positive,1]//Flatten

V7

r=Table[SquaresR[2,n],{n,2500^2}];//Timing

r=Table[SquaresR[2,n],{n,3000^2}];//Timing

r=Table[SquaresR[2,n],{n,4000^2}];//Timing