This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A277214 #17 Aug 17 2018 11:02:20 %S A277214 0,1,2,1,2,3,2,1,2,3,4,3,4,3,4,3,4,5,4,5,6,5,4,5,4,3,2,3,2,3,4,3,4,5, %T A277214 4,3,2,3,4,3,2,3,2,1,2,1,2,3,4,3,4,5,4,3,4,3,2,3,2,3,2,3,2,1,2 %N A277214 a(n) is the Manhattan distance between n and 1 in a 3-dimensional cubic spiral of positive integers with 1..8 at the center (illustration in the comments). %C A277214 Similar to A214526, but three-dimensional, and the core is 2 X 2 X 2 rather than 1 X 1. %C A277214 The spiral begins as follows: %C A277214 Level z=-2: %C A277214 95 94 93 92 91 90 %C A277214 96 77 76 75 74 89 %C A277214 97 78 67 66 73 88 %C A277214 98 79 68 65 72 87 %C A277214 99 80 69 70 71 86 %C A277214 100 81 82 83 84 85 %C A277214 z=-1: %C A277214 116 115 114 113 112 111 %C A277214 117 52 51 50 49 110 %C A277214 118 53 62 61 60 109 %C A277214 119 54 63 64 59 108 %C A277214 120 55 56 57 58 107 %C A277214 101 102 103 104 105 106 %C A277214 z=0: %C A277214 137 136 135 134 133 132 %C A277214 138 39 38 37 48 131 %C A277214 139 40 3 2 47 130 %C A277214 140 41 4 1 46 129 %C A277214 121 42 43 44 45 128 %C A277214 122 123 124 125 126 127 %C A277214 z=1: %C A277214 144 145 146 147 148 149 %C A277214 143 34 35 36 25 150 %C A277214 142 33 6 7 26 151 %C A277214 141 32 5 8 27 152 %C A277214 160 31 30 29 28 153 %C A277214 159 158 157 156 155 154 %C A277214 z=2: %C A277214 165 166 167 168 169 170 %C A277214 164 21 22 23 24 171 %C A277214 163 20 11 12 13 172 %C A277214 162 19 10 9 14 173 %C A277214 161 18 17 16 15 174 %C A277214 180 179 178 177 176 175 %C A277214 z=3: %C A277214 186 187 188 189 190 191 %C A277214 185 204 205 206 207 192 %C A277214 184 203 214 215 208 193 %C A277214 183 202 213 216 209 194 %C A277214 182 201 212 211 210 195 %C A277214 181 200 199 198 197 196 %C A277214 Algorithm sketch: %C A277214 1. At every x-y plane the direction is clockwise if z > 0 and counterclockwise if z <= 0. %C A277214 2. After an N*N cube is complete and we start building an M*M cube, M=N+2: %C A277214 2a. The spiral at the first new edge of the M*M cube progresses from center to edges, in the same way as the A214526 spiral, e.g., z=-2 in the illustration. %C A277214 2b. Between the first and last z-edges the spiral progresses according to item 1. %C A277214 2c. The spiral at the last new edge of the M*M cube progresses from edges to center, e.g., z=3 in the illustration. %F A277214 abs( a(n) - a(n-1) ) = 1. %Y A277214 Cf. A214526. %K A277214 nonn %O A277214 1,3 %A A277214 _Alex Ratushnyak_, Oct 05 2016