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 A217011 #9 Mar 12 2025 20:08:11 %S A217011 1,5,19,6,8,9,10,2,3,4,18,41,73,42,20,7,24,25,26,27,28,11,12,13,14,15, %T A217011 17,40,72,113,163,114,74,43,21,23,49,50,51,52,53,54,55,29,30,31,32,33, %U A217011 34,35,16,39,71,112,162,221 %N A217011 Permutation of natural numbers arising from applying the walk of a square spiral (e.g. A214526) to the data of right triangular type-2 spiral (defined in A214251). %o A217011 (Python) %o A217011 SIZE = 33 # must be 4k+1 %o A217011 grid = [0] * (SIZE*SIZE) %o A217011 posX = posY = SIZE//2 %o A217011 grid[posY*SIZE+posX]=1 %o A217011 n = 2 %o A217011 def walk(stepX, stepY, chkX, chkY): %o A217011 global posX, posY, n %o A217011 while 1: %o A217011 posX+=stepX %o A217011 posY+=stepY %o A217011 grid[posY*SIZE+posX]=n %o A217011 n+=1 %o A217011 if grid[(posY+chkY)*SIZE+posX+chkX]==0: %o A217011 return %o A217011 while 1: %o A217011 walk(-1, 0, 0, -1) # left %o A217011 walk(0, -1, 1, 1) # up %o A217011 if posY==0: %o A217011 break %o A217011 walk( 1, 1, -1, 0) # right-down %o A217011 import sys %o A217011 grid2 = [0] * (SIZE*SIZE) %o A217011 posX = posY = SIZE//2 %o A217011 grid2[posY*SIZE+posX]=1 %o A217011 def walk2(stepX, stepY, chkX, chkY): %o A217011 global posX, posY %o A217011 while 1: %o A217011 a = grid[posY*SIZE+posX] %o A217011 if a==0: %o A217011 sys.exit(1) %o A217011 print(a, end=', ') %o A217011 posX+=stepX %o A217011 posY+=stepY %o A217011 grid2[posY*SIZE+posX]=1 %o A217011 if grid2[(posY+chkY)*SIZE+posX+chkX]==0: %o A217011 return %o A217011 while 1: %o A217011 walk2(0, -1, 1, 0) # up %o A217011 walk2(1, 0, 0, 1) # right %o A217011 walk2(0, 1, -1, 0) # down %o A217011 walk2(-1, 0, 0, -1) # left %Y A217011 Cf. A090861, A214526, A214251, A217010. %K A217011 nonn,easy %O A217011 1,2 %A A217011 _Alex Ratushnyak_, Sep 23 2012