login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A214230 Sum of the eight nearest neighbors of n in a right triangular type-1 spiral with positive integers. 6
53, 88, 78, 125, 85, 84, 125, 97, 108, 143, 223, 168, 158, 169, 201, 284, 208, 183, 179, 187, 210, 281, 226, 219, 227, 235, 261, 314, 430, 339, 311, 310, 318, 326, 346, 396, 515, 403, 360, 347, 355, 363, 371, 379, 411, 509, 427, 411, 419, 427, 435, 443, 451, 486, 557 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,1

COMMENTS

Right triangular type-1 spiral implements the sequence Up, Right-down, Left.

Right triangular type-2 spiral (A214251): Left, Up, Right-down.

Right triangular type-3 spiral (A214252): Right-down, Left, Up.

A140064 -- rightwards from 1: 3,14,34...

A064225 -- leftwards from 1: 8,24,49...

A117625 -- upwards from 1: 2,12,31...

A006137 -- downwards from 1: 6,20,43...

A038764 -- left-down from 1: 7,22,46...

A081267 -- left-up from 1: 9,26,52...

A081589 -- right-up from 1: 13, 61, 145...

9*x^2/2 - 19*x/2 + 6 -- right-down from 1: 5,18,40...

LINKS

Table of n, a(n) for n=1..55.

EXAMPLE

Right triangular spiral begins:

56

55  57

54  29  58

53  28  30  59

52  27  11  31  60

51  26  10  12  32  61

50  25   9   2  13  33  62

49  24   8   1   3  14  34  63

48  23   7   6   5   4  15  35  64

47  22  21  20  19  18  17  16  36  65

46  45  44  43  42  41  40  39  38  37  66

78  77  76  75  74  73  72  71  70  69  68  67

The eight nearest neighbors of 3 are 1, 2, 13, 33, 14, 4, 5, 6. Their sum is a(3)=78.

PROG

(Python)

SIZE=29  # must be odd

grid = [0] * (SIZE*SIZE)

saveX = [0]* (SIZE*SIZE)

saveY = [0]* (SIZE*SIZE)

saveX[1] = saveY[1] = 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

    saveX[n]=posX

    saveY[n]=posY

    n+=1

    if posY==0 or grid[(posY+chkY)*SIZE+posX+chkX]==0:

        return

while 1:

    walk(0, -1,  1,  1)    # up

    if posY==0:

        break

    walk( 1, 1, -1,  0)    # right-down

    walk(-1, 0,  0, -1)    # left

for n in range(1, 92):

    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]

    k+= grid[posY*SIZE+posX-1] + grid[posY*SIZE+posX+1]

    print k,

CROSSREFS

Cf. A214251, A214252.

Cf. A214226, A214231.

Sequence in context: A144939 A118149 A251144 * A272367 A119289 A124282

Adjacent sequences:  A214227 A214228 A214229 * A214231 A214232 A214233

KEYWORD

nonn,easy

AUTHOR

Alex Ratushnyak, Jul 08 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 | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 25 22:49 EDT 2020. Contains 337346 sequences. (Running on oeis4.)