- #1
SwiftxStuff
- 1
- 0
The problem statement
Form a formula to generate every value in the 10x10 square spiral shown above. Use the variables: x = the column of the cell, y = the row of the cell, s = the size of the spiral (in this case 10).
The formula must work for any size of spiral, where s is the width and height of the spiral.
Solution attempt
Let a = the value of the cell
a = x + y - 1
This works for the first row and the first column of 10-19, but doesn't work for any further numbers.
Form a formula to generate every value in the 10x10 square spiral shown above. Use the variables: x = the column of the cell, y = the row of the cell, s = the size of the spiral (in this case 10).
The formula must work for any size of spiral, where s is the width and height of the spiral.
Solution attempt
Let a = the value of the cell
a = x + y - 1
This works for the first row and the first column of 10-19, but doesn't work for any further numbers.