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 A217014 #8 Mar 12 2025 20:15:32 %S A217014 1,7,22,8,2,3,4,6,20,42,21,44,75,45,23,9,11,12,13,14,15,5,19,41,71, %T A217014 109,72,43,74,113,160,114,76,46,24,10,28,29,30,31,32,33,34,16,18,40, %U A217014 70,108,154,208,155,110,73,112,159,214 %N A217014 Permutation of natural numbers arising from applying the walk of a square spiral (e.g. A214526) to the data of triangular horizontal-last spiral (defined in A214226). %o A217014 (Python) %o A217014 SIZE = 33 # must be 4k+1 %o A217014 grid = [0] * (SIZE*SIZE) %o A217014 posX = posY = SIZE//2 %o A217014 grid[posY*SIZE+posX]=1 %o A217014 n = 2 %o A217014 def walk(stepX, stepY, chkX, chkY): %o A217014 global posX, posY, n %o A217014 while 1: %o A217014 posX+=stepX %o A217014 posY+=stepY %o A217014 grid[posY*SIZE+posX]=n %o A217014 n+=1 %o A217014 if grid[(posY+chkY)*SIZE+posX+chkX]==0: %o A217014 return %o A217014 while 1: %o A217014 walk(1, 1, -1, 0) # down-right %o A217014 walk(-1, 0, 1, -1) # left %o A217014 walk(-1, 0, 1, -1) # left %o A217014 if posX<2: %o A217014 break %o A217014 walk(1, -1, 1, 1) # up-right %o A217014 import sys %o A217014 grid2 = [0] * (SIZE*SIZE) %o A217014 posX = posY = SIZE//2 %o A217014 grid2[posY*SIZE+posX]=1 %o A217014 def walk2(stepX, stepY, chkX, chkY): %o A217014 global posX, posY %o A217014 while 1: %o A217014 a = grid[posY*SIZE+posX] %o A217014 if a==0: %o A217014 sys.exit(1) %o A217014 print(a, end=', ') %o A217014 posX+=stepX %o A217014 posY+=stepY %o A217014 grid2[posY*SIZE+posX]=1 %o A217014 if grid2[(posY+chkY)*SIZE+posX+chkX]==0: %o A217014 return %o A217014 while 1: %o A217014 walk2(0, -1, 1, 0) # up %o A217014 walk2(1, 0, 0, 1) # right %o A217014 walk2(0, 1, -1, 0) # down %o A217014 walk2(-1, 0, 0, -1) # left %Y A217014 Cf. A090861, A214526, A214226, A217010. %K A217014 nonn,easy %O A217014 1,2 %A A217014 _Alex Ratushnyak_, Sep 23 2012