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