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 A217294 #7 Nov 07 2024 15:22:10 %S A217294 1,8,2,4,16,5,6,7,22,45,23,9,11,3,15,35,63,36,17,18,19,20,21,44,75, %T A217294 114,76,46,24,10,28,12,14,34,62,98,142,99,64,37,38,39,40,41,42,43,74, %U A217294 113,160,215,161,115,77,47,25,27,53,29,13,33,61,97,141,193,253 %N A217294 Permutation of natural numbers arising from applying the walk of triangular horizontal-first spiral (defined in A214250) to the data of square spiral (e.g. A214526). %o A217294 (Python) %o A217294 SIZE = 29 # must be 4k+1 %o A217294 grid = [0] * (SIZE*SIZE) %o A217294 posX = posY = SIZE//2 %o A217294 grid[posY*SIZE+posX]=1 %o A217294 n = 2 %o A217294 def walk(stepX, stepY, chkX, chkY): %o A217294 global posX, posY, n %o A217294 while 1: %o A217294 posX+=stepX %o A217294 posY+=stepY %o A217294 grid[posY*SIZE+posX]=n %o A217294 n+=1 %o A217294 if grid[(posY+chkY)*SIZE+posX+chkX]==0: %o A217294 return %o A217294 while posX: %o A217294 walk(0, -1, 1, 0) # up %o A217294 walk(1, 0, 0, 1) # right %o A217294 walk(0, 1, -1, 0) # down %o A217294 walk(-1, 0, 0, -1) # left %o A217294 import sys %o A217294 grid2 = [0] * (SIZE*SIZE) %o A217294 posX = posY = SIZE//2 %o A217294 grid2[posY*SIZE+posX]=1 %o A217294 def walk2(stepX, stepY, chkX, chkY): %o A217294 global posX, posY %o A217294 while 1: %o A217294 a = grid[posY*SIZE+posX] %o A217294 if a==0: %o A217294 sys.exit(1) %o A217294 print(a, end=', ') %o A217294 posX+=stepX %o A217294 posY+=stepY %o A217294 grid2[posY*SIZE+posX]=1 %o A217294 if grid2[(posY+chkY)*SIZE+posX+chkX]==0: %o A217294 return %o A217294 while posX<SIZE-2: %o A217294 walk2(-1, 0, 1, -1) # left %o A217294 walk2(1, -1, 1, 1) # up-right %o A217294 walk2(1, 1, -1, 0) # down-right %o A217294 walk2(-1, 0, 1, -1) # left %Y A217294 Cf. A214250, A214526, A217013. %K A217294 nonn %O A217294 1,2 %A A217294 _Alex Ratushnyak_, Sep 30 2012