<s>[INST] Adding pieces on NxN chess board sequentially The problem is:
Given a $N\times N$ chess board, if you put $B$ pieces starting on square $1,1$ and going right, then down, then left, then up when possible (thus, forming an spiral), in which coordinate the last piece would be put?
Example: $8\times8$ board, $53$ pieces
Putting $8$ on first row, then $7$ down, then $7$ left, then $6$ up, then $6$ right and so on, would give me position (row $4$, col $6$)
Please note the iterative solution is too costly, as $N$ can go up to $2^{30}$ and $B$ up to $2^{60}$.
 [/INST] Assuming we have completed $x$ spirals (and no more spirals can be completed) 
Then we have
(Comparing number of pieces utilized by $x$ and $x+1$ spirals)
$$ n^2-(n-2x)^2\le B\le n^2-(n-2x-2)^2$$
Now,$$n^2-(n-2x)^2\le B\implies n^2-B\le (n-2x)^2\implies x\le\frac{n-\sqrt{n^2-B}}{2}$$
Or,
$$n^2-(n-2x-2)^2\ge B\implies n^2-B\ge (n-2x-2)^2\implies x\ge\frac{n-\sqrt{n^2-B}}{2}-1$$
We get
$$\frac{n-\sqrt{n^2-B}}{2}-1\le x\le\frac{n-\sqrt{n^2-B}}{2}$$
For our purpose we can safely say 

$$\left\lceil{\frac{n-\sqrt{n^2-B}} {2}}-1\right\rceil=x=\left\lfloor{\frac{n-\sqrt{n^2-B}} {2}}\right\rfloor$$

Now we have number of completed spirals then it's not difficult to obtain position of last piece.
</s>