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 A217291 #11 Mar 12 2025 20:14:56 %S A217291 1,2,4,16,5,6,7,8,9,10,27,11,3,15,35,63,36,17,18,19,20,21,22,23,24,25, %T A217291 26,51,84,52,28,12,14,34,62,98,142,99,64,37,38,39,40,41,42,43,44,45, %U A217291 46,47,48,49,50,83,124,173,125,85,53,29,13,33,61,97,141,193,253 %N A217291 Permutation of natural numbers arising from applying the walk of right triangular type-1 spiral (defined in A214230) to the data of square spiral (e.g. A214526). %o A217291 (Python) %o A217291 SIZE = 29 # must be 4k+1 %o A217291 grid = [0] * (SIZE*SIZE) %o A217291 posX = posY = SIZE//2 %o A217291 grid[posY*SIZE+posX]=1 %o A217291 n = 2 %o A217291 def walk(stepX, stepY, chkX, chkY): %o A217291 global posX, posY, n %o A217291 while 1: %o A217291 posX+=stepX %o A217291 posY+=stepY %o A217291 grid[posY*SIZE+posX]=n %o A217291 n+=1 %o A217291 if grid[(posY+chkY)*SIZE+posX+chkX]==0: %o A217291 return %o A217291 while posX: %o A217291 walk(0, -1, 1, 0) # up %o A217291 walk(1, 0, 0, 1) # right %o A217291 walk(0, 1, -1, 0) # down %o A217291 walk(-1, 0, 0, -1) # left %o A217291 import sys %o A217291 grid2 = [0] * (SIZE*SIZE) %o A217291 posX = posY = SIZE//2 %o A217291 grid2[posY*SIZE+posX]=1 %o A217291 def walk2(stepX, stepY, chkX, chkY): %o A217291 global posX, posY %o A217291 while 1: %o A217291 a = grid[posY*SIZE+posX] %o A217291 if a==0: %o A217291 sys.exit(1) %o A217291 print(a, end=', ') %o A217291 posX+=stepX %o A217291 posY+=stepY %o A217291 grid2[posY*SIZE+posX]=1 %o A217291 if grid2[(posY+chkY)*SIZE+posX+chkX]==0: %o A217291 return %o A217291 while 1: %o A217291 walk2(0, -1, 1, 1) # up %o A217291 walk2( 1, 1, -1, 0) # right-down %o A217291 if posX==SIZE-1: %o A217291 break %o A217291 walk2(-1, 0, 0, -1) # left %Y A217291 Cf. A214230, A214526, A217010. %K A217291 nonn %O A217291 1,2 %A A217291 _Alex Ratushnyak_, Sep 30 2012