Inspired by Tad
Consider the rectangular spiral in the image below. It starts from the origin and twirls and twirls forever in an anticlockwise direction along the integer coordinates of the Cartesian coordinate plane. Each point along the spiral is numbered with an integer \(Z\) as shown in the image below.
Let \(f(Z)\) be the sum of \(x\) and \(y\) coordinate of the point numbered \(Z\). What is the value of \(f(6664001)+f(8875172)+f(4820669)\)?
As an explicit example, the point \(Z=3\) is \((0,1)\), hence \(f(3)=0+1=1\).