Problem 2644. The Ulam Matrix
The Ulam spiral is simple to describe. On a gridded piece of paper, write down the number 1. Then write successive integers as you spiral out in a counter-clockwise fashion. For example:
17 16 15 14 13 18 5 4 3 12 19 6 1 2 11 20 7 8 9 10 21 22 23 24 25
Although you can stop writing numbers at any time, for the purpose of this problem let's assume you want to fill an N x N square matrix with numbers from 1 to N^2.
Solution Stats
Problem Comments
-
1 Comment
Mattias
on 3 Jan 2015
Nice problem! At least if you don't use MATLAB's existing function for this.
Solution Comments
Show commentsProblem Recent Solvers42
Suggested Problems
-
Remove the small words from a list of words.
1528 Solvers
-
1409 Solvers
-
Given a matrix, swap the 2nd & 3rd columns
1150 Solvers
-
07 - Common functions and indexing 5
414 Solvers
-
603 Solvers
More from this Author2
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!