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.

Showing 1-4 of 4 results.

A214230 Sum of the eight nearest neighbors of n in a right triangular type-1 spiral with positive integers.

Original entry on oeis.org

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
Offset: 1

Views

Author

Alex Ratushnyak, Jul 08 2012

Keywords

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...

Examples

			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.
		

Crossrefs

Programs

  • 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, end=', ')

A192136 a(n) = (5*n^2 - 3*n + 2)/2.

Original entry on oeis.org

1, 2, 8, 19, 35, 56, 82, 113, 149, 190, 236, 287, 343, 404, 470, 541, 617, 698, 784, 875, 971, 1072, 1178, 1289, 1405, 1526, 1652, 1783, 1919, 2060, 2206, 2357, 2513, 2674, 2840, 3011, 3187, 3368, 3554, 3745, 3941, 4142, 4348, 4559, 4775, 4996, 5222, 5453, 5689
Offset: 0

Views

Author

Eric Werley, Jun 24 2011

Keywords

Comments

Binomial transform of [1, 1, 5, 0, 0, 0, 0, 0, ...]. - Johannes W. Meijer, Jul 07 2011

Crossrefs

Programs

Formula

a(n) = (5*n^2 - 3*n + 2)/2.
a(n) = 2*a(n-1) - a(n-2) + 5.
a(n) = a(n-1) + 5*n - 4.
a(n) = 5*binomial(n+2,2) - 9*n - 4.
a(n) = A000217(n+1) - A000217(n) + 5*A000217(n-1); triangular numbers. - Johannes W. Meijer, Jul 07 2011
O.g.f.: (1-x+5*x^2)/(1-x)^3.
From Elmo R. Oliveira, Nov 16 2024: (Start)
E.g.f.: exp(x)*(2 + 2*x + 5*x^2)/2.
a(n) = 3*a(n-1) - 3*a(n-2) + a(n-3) for n > 2. (End)

A276819 a(n) = (9*n^2 - n)/2 + 1.

Original entry on oeis.org

1, 5, 18, 40, 71, 111, 160, 218, 285, 361, 446, 540, 643, 755, 876, 1006, 1145, 1293, 1450, 1616, 1791, 1975, 2168, 2370, 2581, 2801, 3030, 3268, 3515, 3771, 4036, 4310, 4593, 4885, 5186, 5496, 5815, 6143, 6480, 6826, 7181, 7545, 7918, 8300, 8691, 9091, 9500, 9918, 10345, 10781, 11226, 11680, 12143, 12615
Offset: 0

Views

Author

Yuriy Sibirmovsky, Sep 18 2016

Keywords

Comments

Diagonal of triangular spiral in A051682. The other 5 diagonals are given by A140064, A117625, A081267, A064225, A006137. See the link as well.
First differences are given by A017209.
72*a(n) - 71 is a perfect square. - Klaus Purath, Jan 14 2022

Crossrefs

Programs

  • Mathematica
    Table[(9*n^2-n)/2+1, {n,0,100}]
  • PARI
    Vec((1+2*x+6*x^2)/(1-x)^3 + O(x^60)) \\ Colin Barker, Sep 18 2016
    
  • PARI
    a(n) = (9*n^2 - n)/2 + 1; \\ Altug Alkan, Sep 18 2016

Formula

a(n) = (9*n^2 - n)/2 + 1.
a(n) = a(n-1) + 9*n - 5 with a(0) = 1.
From Colin Barker, Sep 18 2016: (Start)
a(n) = 3*a(n-1) - 3*a(n-2) + a(n-3) for n > 2.
G.f.: (1 + 2*x + 6*x^2)/(1 - x)^3. (End)
From Klaus Purath, Jan 14 2022: (Start)
a(n) = A006137(n) - n.
A003215(a(n)) - A003215(a(n)-3) = A002378(9*n-1). (End)
E.g.f.: exp(x)*(2 + 8*x + 9*x^2)/2. - Stefano Spezia, Dec 25 2022

A358994 The sum of the numbers that are inside the contour of an n-story Christmas tree drawn at the top of the numerical pyramid containing the positive integers in natural order.

Original entry on oeis.org

21, 151, 561, 1503, 3310, 6396, 11256, 18466, 28683, 42645, 61171, 85161, 115596, 153538, 200130, 256596, 324241, 404451, 498693, 608515, 735546, 881496, 1048156, 1237398, 1451175, 1691521, 1960551, 2260461, 2593528, 2962110, 3368646, 3815656, 4305741, 4841583, 5425945
Offset: 1

Views

Author

Nicolay Avilov, Dec 25 2022

Keywords

Comments

The numbers of the natural series are written line by line in the form of a numerical pyramid: the first line contains the number 1, the second line contains the next two numbers 2 and 3, the third line contains the next three numbers 4, 5 and 6, etc.; that is, the line starting with the number k contains the k following numbers. In this numerical pyramid, the contour of a "multi-story Christmas tree" is distinguished, each floor of which occupies three lines. The numbers of the sequence are the sum of all the numbers that fall into the contour of the Christmas tree, which has n floors.

Examples

			a(1) = 1 + 2 + 3 + 4 + 5 + 6 = 21;
a(2) = a(1) + (8 + 9 + 12 + 13 + 14 + 17 +18 + 19 + 20) = 151.
		

Crossrefs

Programs

  • Magma
    [n*(27*n^3 + 66*n^2 + 49*n + 26)/8 : n in [1..60]]; // Wesley Ivan Hurt, Jun 14 2025
  • Python
    def a(n): return n*(27*n**3 + 66*n**2 + 49*n + 26) // 8
    print([a(n) for n in range(1, 36)]) # Michael S. Branicky, Dec 25 2022
    

Formula

a(n) = n*(27*n^3 + 66*n^2 + 49*n + 26) / 8.
G.f.: x*(21 + 46*x + 16*x^2 - 2*x^3)/(1 - x)^5. - Stefano Spezia, Dec 25 2022
a(n) = 5*a(n-1) - 10*a(n-2) + 10*a(n-3) - 5*a(n-4) + a(n-5). - Wesley Ivan Hurt, Jun 14 2025
Showing 1-4 of 4 results.