RosettaCodeData/Task/Spiral-matrix/00DESCRIPTION
2016-12-05 22:15:40 +01:00

23 lines
544 B
Text

;Task:
Produce a spiral array.
A &nbsp; ''spiral array'' &nbsp; is a square arrangement of the first &nbsp; <big> N<sup>2</sup></big> &nbsp; natural numbers, &nbsp; where the
<br>numbers increase sequentially as you go around the edges of the array spiraling inwards.
For example, given &nbsp; '''5''', &nbsp; produce this array:
<pre>
0 1 2 3 4
15 16 17 18 5
14 23 24 19 6
13 22 21 20 7
12 11 10 9 8
</pre>
;Related tasks:
* &nbsp; [[Zig-zag matrix]]
* &nbsp; [[Identity_matrix]]
* &nbsp; [[Ulam_spiral_(for_primes)]]
<br><br>