A217013 Permutation of natural numbers arising from applying the walk of a square spiral (e.g. A214526) to the data of triangular horizontal-first spiral (defined in A214250).
1, 3, 14, 4, 6, 7, 8, 2, 12, 30, 13, 32, 59, 33, 15, 5, 19, 20, 21, 22, 23, 9, 11, 29, 55, 89, 56, 31, 58, 93, 136, 94, 60, 34, 16, 18, 40, 41, 42, 43, 44, 45, 46, 24, 10, 28, 54, 88, 130, 180, 131, 90, 57, 92, 135, 186, 245, 187, 137, 95, 61, 35, 17, 39, 69
Offset: 1
Programs
-
Python
SIZE = 33 # must be 4k+1 grid = [0] * (SIZE*SIZE) posX = posY = SIZE//2 grid[posY*SIZE+posX]=1 n = 2 def walk(stepX, stepY, chkX, chkY): global posX, posY, n while 1: posX+=stepX posY+=stepY grid[posY*SIZE+posX]=n n+=1 if grid[(posY+chkY)*SIZE+posX+chkX]==0: return while posX