The OEIS is supported by the many generous donors to the OEIS Foundation.

 Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 59th year, we have over 358,000 sequences, and we’ve crossed 10,300 citations (which often say “discovered thanks to the OEIS”). Other ways to Give
 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A214176 Sum of the 8 nearest neighbors of n in a spiral with positive integers. 8
 44, 58, 72, 62, 96, 82, 120, 94, 104, 152, 120, 130, 184, 146, 144, 164, 224, 180, 176, 198, 264, 214, 208, 216, 240, 312, 256, 248, 256, 282, 360, 298, 288, 296, 304, 332, 416, 348, 336, 344, 352, 382, 472, 398, 384, 392, 400, 408, 440, 536, 456, 440 (list; graph; refs; listen; history; text; internal format)
 OFFSET 1,1 LINKS Rémy Sigrist, Table of n, a(n) for n = 1..5202 Rémy Sigrist, PARI program for A214176 EXAMPLE Spiral begins: . 49 26--27--28--29--30--31 | | | 48 25 10--11--12--13 32 | | | | | 47 24 9 2---3 14 33 | | | | | | | 46 23 8 1 4 15 34 | | | | | | 45 22 7---6---5 16 35 | | | | 44 21--20--19--18--17 36 | | 43--42--41--40--39--38--37 . The 8 nearest neighbors of 2 are 1,3,4,8,9,10,11,12. Their sum is a(2)=58. PROG (Python) SIZE=11 # must be odd grid = [0] * (SIZE*SIZE) posX = posY = SIZE//2 grid[posY*SIZE+posX]=1 n = 2 saveX = [0]* (SIZE*SIZE+1) saveY = [0]* (SIZE*SIZE+1) saveX[1]=posX saveY[1]=posY def walk(stepX, stepY, chkX, chkY): global posX, posY, n while 1: posX+=stepX posY+=stepY grid[posY*SIZE+posX]=n saveX[n]=posX saveY[n]=posY n+=1 if posX+posY==0 or grid[(posY+chkY)*SIZE+posX+chkX]==0: return while 1: walk(0, -1, 1, 0) # up if posX+posY==0: break walk(1, 0, 0, 1) # right walk(0, 1, -1, 0) # down walk(-1, 0, 0, -1) # left for n in range(1, (SIZE-2)*(SIZE-2)+1): posX = saveX[n] posY = saveY[n] k = grid[(posY-1)*SIZE+posX] + grid[(posY+1)*SIZE+posX] k+= grid[(posY-1)*SIZE+posX-1] + grid[(posY-1)*SIZE+posX+1] k+= grid[(posY+1)*SIZE+posX-1] + grid[(posY+1)*SIZE+posX+1] print k+grid[posY*SIZE+posX-1] + grid[posY*SIZE+posX+1], (PARI) See Links section. CROSSREFS Cf. A002061, A114254, A137928, A137930, A137931. Cf. A214177 (sum of the 4 nearest neighbors). Sequence in context: A270298 A231402 A116227 * A306116 A185590 A029690 Adjacent sequences: A214173 A214174 A214175 * A214177 A214178 A214179 KEYWORD nonn,easy AUTHOR Alex Ratushnyak, Jul 06 2012 STATUS approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified December 6 14:43 EST 2022. Contains 358644 sequences. (Running on oeis4.)