Given the matrix A x A and a number of movements N.
And walking like a spiral:
- right while possible, then
- down while possible, then
- left while possible, then
- up while possible, repeat until got
N.
Image with example (A = 8; N = 36)
In this example case, the final square is (4; 7).
My question is: Is it possible to use a generic formula to solve this?

A = 8; N = 36) are very very low numbers. The closest I can get toNwould be nice. – removed Nov 06 '15 at 03:24