Template:Ulam spiral
Jump to navigation
Jump to search
Template documentation
This template uses Lua: |
Produces an Ulam spiral.
Usage
{{Ulam spiral|11|0}} where 11 is the number of rows and columns (11 x 11) and 0 is the start number, returns
100 | 99 | 98 | 97 | 96 | 95 | 94 | 93 | 92 | 91 | 90 |
101 | 64 | 63 | 62 | 61 | 60 | 59 | 58 | 57 | 56 | 89 |
102 | 65 | 36 | 35 | 34 | 33 | 32 | 31 | 30 | 55 | 88 |
103 | 66 | 37 | 16 | 15 | 14 | 13 | 12 | 29 | 54 | 87 |
104 | 67 | 38 | 17 | 4 | 3 | 2 | 11 | 28 | 53 | 86 |
105 | 68 | 39 | 18 | 5 | 0 | 1 | 10 | 27 | 52 | 85 |
106 | 69 | 40 | 19 | 6 | 7 | 8 | 9 | 26 | 51 | 84 |
107 | 70 | 41 | 20 | 21 | 22 | 23 | 24 | 25 | 50 | 83 |
108 | 71 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 82 |
109 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 |
110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 |
The maximum accepted value for rows/columns is 75.
Example
Larger dimensions also display green (numbers with just 3 divisors) and red (numbers with 25 or more divisors) coloured backgrounds, and the font size is adjusted automatically. E.g. {{Ulam spiral|31|0}}