cp's OEIS Frontend

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.

A217293 Permutation of natural numbers arising from applying the walk of right triangular type-3 spiral (defined in A214252) to the data of square spiral (e.g. A214526).

This page as a plain text file.
%I A217293 #9 Mar 04 2025 14:46:52
%S A217293 1,5,6,7,8,9,10,2,4,16,36,17,18,19,20,21,22,23,24,25,26,51,27,11,3,15,
%T A217293 35,63,99,64,37,38,39,40,41,42,43,44,45,46,47,48,49,50,83,124,84,52,
%U A217293 28,12,14,34,62,98,142,194,143,100,65,66,67,68,69,70,71,72
%N A217293 Permutation of natural numbers arising from applying the walk of right triangular type-3 spiral (defined in A214252) to the data of square spiral (e.g. A214526).
%o A217293 (Python)
%o A217293 SIZE = 29    # must be 4k+1
%o A217293 grid = [0] * (SIZE*SIZE)
%o A217293 posX = posY = SIZE//2
%o A217293 grid[posY*SIZE+posX]=1
%o A217293 n = 2
%o A217293 def walk(stepX, stepY, chkX, chkY):
%o A217293   global posX, posY, n
%o A217293   while 1:
%o A217293     posX+=stepX
%o A217293     posY+=stepY
%o A217293     grid[posY*SIZE+posX]=n
%o A217293     n+=1
%o A217293     if grid[(posY+chkY)*SIZE+posX+chkX]==0:
%o A217293         return
%o A217293 while posX:
%o A217293     walk(0, -1, 1, 0)    # up
%o A217293     walk(1, 0, 0, 1)     # right
%o A217293     walk(0, 1, -1, 0)    # down
%o A217293     walk(-1, 0, 0, -1)   # left
%o A217293 import sys
%o A217293 grid2 = [0] * (SIZE*SIZE)
%o A217293 posX = posY = SIZE//2
%o A217293 grid2[posY*SIZE+posX]=1
%o A217293 def walk2(stepX, stepY, chkX, chkY):
%o A217293   global posX, posY
%o A217293   while 1:
%o A217293     a = grid[posY*SIZE+posX]
%o A217293     if a==0:
%o A217293         sys.exit(1)
%o A217293     print(a, end=', ')
%o A217293     posX+=stepX
%o A217293     posY+=stepY
%o A217293     grid2[posY*SIZE+posX]=1
%o A217293     if grid2[(posY+chkY)*SIZE+posX+chkX]==0:
%o A217293         return
%o A217293 while posY!=0:
%o A217293     walk2( 1, 1, -1,  0)    # right-down
%o A217293     walk2(-1, 0,  0, -1)    # left
%o A217293     walk2(0, -1,  1,  1)    # up
%Y A217293 Cf. A214252, A214526, A217012.
%K A217293 nonn
%O A217293 1,2
%A A217293 _Alex Ratushnyak_, Sep 30 2012