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 A214230 #27 Jun 06 2025 18:35:30 %S A214230 53,88,78,125,85,84,125,97,108,143,223,168,158,169,201,284,208,183, %T A214230 179,187,210,281,226,219,227,235,261,314,430,339,311,310,318,326,346, %U A214230 396,515,403,360,347,355,363,371,379,411,509,427,411,419,427,435,443,451,486,557 %N A214230 Sum of the eight nearest neighbors of n in a right triangular type-1 spiral with positive integers. %C A214230 Right triangular type-1 spiral implements the sequence Up, Right-down, Left. %C A214230 Right triangular type-2 spiral (A214251): Left, Up, Right-down. %C A214230 Right triangular type-3 spiral (A214252): Right-down, Left, Up. %C A214230 A140064 -- rightwards from 1: 3,14,34... %C A214230 A064225 -- leftwards from 1: 8,24,49... %C A214230 A117625 -- upwards from 1: 2,12,31... %C A214230 A006137 -- downwards from 1: 6,20,43... %C A214230 A038764 -- left-down from 1: 7,22,46... %C A214230 A081267 -- left-up from 1: 9,26,52... %C A214230 A081589 -- right-up from 1: 13, 61, 145... %C A214230 9*x^2/2 - 19*x/2 + 6 -- right-down from 1: 5,18,40... %H A214230 David Radcliffe, <a href="/A214230/b214230.txt">Table of n, a(n) for n = 1..10000</a> %e A214230 Right triangular spiral begins: %e A214230 56 %e A214230 55 57 %e A214230 54 29 58 %e A214230 53 28 30 59 %e A214230 52 27 11 31 60 %e A214230 51 26 10 12 32 61 %e A214230 50 25 9 2 13 33 62 %e A214230 49 24 8 1 3 14 34 63 %e A214230 48 23 7 6 5 4 15 35 64 %e A214230 47 22 21 20 19 18 17 16 36 65 %e A214230 46 45 44 43 42 41 40 39 38 37 66 %e A214230 78 77 76 75 74 73 72 71 70 69 68 67 %e A214230 The eight nearest neighbors of 3 are 1, 2, 13, 33, 14, 4, 5, 6. Their sum is a(3)=78. %o A214230 (Python) %o A214230 SIZE=29 # must be odd %o A214230 grid = [0] * (SIZE*SIZE) %o A214230 saveX = [0]* (SIZE*SIZE) %o A214230 saveY = [0]* (SIZE*SIZE) %o A214230 saveX[1] = saveY[1] = posX = posY = SIZE//2 %o A214230 grid[posY*SIZE+posX]=1 %o A214230 n = 2 %o A214230 def walk(stepX,stepY,chkX,chkY): %o A214230 global posX, posY, n %o A214230 while 1: %o A214230 posX+=stepX %o A214230 posY+=stepY %o A214230 grid[posY*SIZE+posX]=n %o A214230 saveX[n]=posX %o A214230 saveY[n]=posY %o A214230 n+=1 %o A214230 if posY==0 or grid[(posY+chkY)*SIZE+posX+chkX]==0: %o A214230 return %o A214230 while 1: %o A214230 walk(0, -1, 1, 1) # up %o A214230 if posY==0: %o A214230 break %o A214230 walk( 1, 1, -1, 0) # right-down %o A214230 walk(-1, 0, 0, -1) # left %o A214230 for n in range(1,92): %o A214230 posX = saveX[n] %o A214230 posY = saveY[n] %o A214230 k = grid[(posY-1)*SIZE+posX] + grid[(posY+1)*SIZE+posX] %o A214230 k+= grid[(posY-1)*SIZE+posX-1] + grid[(posY-1)*SIZE+posX+1] %o A214230 k+= grid[(posY+1)*SIZE+posX-1] + grid[(posY+1)*SIZE+posX+1] %o A214230 k+= grid[posY*SIZE+posX-1] + grid[posY*SIZE+posX+1] %o A214230 print(k, end=', ') %Y A214230 Cf. A214251, A214252. %Y A214230 Cf. A214226, A214231. %K A214230 nonn,easy %O A214230 1,1 %A A214230 _Alex Ratushnyak_, Jul 08 2012