How to arrange number sequence in a spiral
I want to write a function that takes a number (n) and outputs a sequence of numbers (1 to n x n) in the form of an n*n grid, with the numbers arranged in a spiral. The starting position is either the center. With an input n=3 and pos = "center" then
results for example:
5  4  3
6  1  2
7  8  9
Or the number sequence starts in one of the corners. With an input n=4 and pos = "top right" the result is for example:
4   3   2   1
5  14  13  12
6  15  16  11
7   8   9  10
Does anyone have an idea how to get a specific position in the grid? And how to arrange the sequence in a spiral instead of entering it column by column or row by row?
