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-10 of 10 results.

A278180 Square spiral in which each new term is the sum of its two largest neighbors.

Original entry on oeis.org

1, 1, 2, 3, 4, 7, 8, 15, 16, 17, 33, 35, 37, 72, 76, 80, 84, 164, 172, 180, 188, 368, 384, 401, 418, 435, 853, 888, 925, 962, 999, 1961, 2037, 2117, 2201, 2285, 2369, 4654, 4826, 5006, 5194, 5382, 5570, 10952, 11336, 11737, 12155, 12590, 13025, 13460, 26485, 27373, 28298, 29260, 30259, 31258, 32257, 63515
Offset: 1

Views

Author

Omar E. Pol, Nov 14 2016

Keywords

Comments

To evaluate a(n) consider the neighbors of a(n) that are present in the spiral when a(n) should be a new term in the spiral.
For the same idea but for a hexagonal spiral see A278619; and for a right triangle see A278645. It appears that the same idea for an isosceles triangle and also for a square array gives A030237. - Omar E. Pol, Dec 04 2016

Examples

			Illustration of initial terms as a square spiral:
.
.          84----80----76-----72----37
.           |                        |
.          164    4-----3-----2     35
.           |     |           |      |
.          172    7     1-----1     33
.           |     |                  |
.          180    8-----15----16----17
.           |
.          188---368---384---401---418
.
a(21) = 188 because the sum of its two largest neighbors is 180 + 8 = 188.
a(22) = 368 because the sum of its two largest neighbors is 180 + 188 = 368.
a(23) = 384 because the sum of its two largest neighbors is 368 + 16 = 384.
a(24) = 401 because the sum of its two largest neighbors is 384 + 17 = 401.
a(25) = 418 because the sum of its two largest neighbors is 401 + 17 = 418.
a(26) = 435 because the sum of its two largest neighbors is 418 + 17 = 435.
		

Crossrefs

A334742 Pascal's spiral: starting with a(1) = 1, proceed in a square spiral, computing each term as the sum of horizontally and vertically adjacent prior terms.

Original entry on oeis.org

1, 1, 1, 2, 2, 3, 3, 4, 5, 5, 6, 7, 7, 8, 10, 12, 12, 14, 17, 20, 20, 23, 27, 32, 37, 37, 42, 48, 55, 62, 62, 69, 77, 87, 99, 111, 111, 123, 137, 154, 174, 194, 194, 214, 237, 264, 296, 333, 370, 370, 407, 449, 497, 552, 614, 676, 676, 738, 807, 884, 971, 1070
Offset: 1

Views

Author

Alec Jones and Peter Kagey, May 09 2020

Keywords

Comments

This is the square spiral analogy of Pascal's triangle thought of as a table read by antidiagonals.

Examples

			Spiral begins:
  111--99--87--77--69--62
                        |
   12--12--10---8---7  62
    |               |   |
   14   2---2---1   7  55
    |   |       |   |   |
   17   3   1---1   6  48
    |   |           |   |
   20   3---4---5---5  42
    |                   |
   20--23--27--32--37--37
a(15) = 10 = 8 + 2, the sum of the cells immediately to the right and below. The term to the left is not included in the sum because it has not yet occurred in the spiral.
		

Crossrefs

x- and y-coordinates are given by A174344 and A274923, respectively.

Formula

a(A033638(n)) = a(A002620(n)) for n > 1.

A278354 Number of neighbors of each new term in a square spiral.

Original entry on oeis.org

0, 1, 2, 3, 2, 3, 2, 4, 3, 2, 4, 3, 2, 4, 4, 3, 2, 4, 4, 3, 2, 4, 4, 4, 3, 2, 4, 4, 4, 3, 2, 4, 4, 4, 4, 3, 2, 4, 4, 4, 4, 3, 2, 4, 4, 4, 4, 4, 3, 2, 4, 4, 4, 4, 4, 3, 2, 4, 4, 4, 4, 4, 4, 3, 2, 4, 4, 4, 4, 4, 4, 3, 2, 4, 4, 4, 4, 4, 4, 4, 3, 2, 4, 4, 4, 4, 4, 4, 4, 3, 2, 4, 4, 4, 4, 4, 4, 4, 4, 3, 2, 4, 4, 4, 4
Offset: 1

Views

Author

Omar E. Pol, Nov 19 2016

Keywords

Comments

Here the "neighbors" of a(n) are defined to be the adjacent elements to a(n) in the same row, column or diagonals, that are present in the spiral when a(n) is the new element of the sequence in progress.
For the same idea but for a right triangle see A278317; for an isosceles triangle see A275015; for a square array see A278290; and for a hexagonal spiral see A047931.

Examples

			Illustration of initial terms as a spiral (n = 1..169):
.
.     2 - 3 - 4 - 4 - 4 - 4 - 4 - 4 - 4 - 4 - 4 - 4 - 2
.     |                                               |
.     4   2 - 3 - 4 - 4 - 4 - 4 - 4 - 4 - 4 - 4 - 2   3
.     |   |                                       |   |
.     4   4   2 - 3 - 4 - 4 - 4 - 4 - 4 - 4 - 2   3   4
.     |   |   |                               |   |   |
.     4   4   4   2 - 3 - 4 - 4 - 4 - 4 - 2   3   4   4
.     |   |   |   |                       |   |   |   |
.     4   4   4   4   2 - 3 - 4 - 4 - 2   3   4   4   4
.     |   |   |   |   |               |   |   |   |   |
.     4   4   4   4   4   2 - 3 - 2   3   4   4   4   4
.     |   |   |   |   |   |       |   |   |   |   |   |
.     4   4   4   4   4   3   0 - 1   4   4   4   4   4
.     |   |   |   |   |   |           |   |   |   |   |
.     4   4   4   4   3   2 - 4 - 3 - 2   4   4   4   4
.     |   |   |   |   |                   |   |   |   |
.     4   4   4   3   2 - 4 - 4 - 4 - 3 - 2   4   4   4
.     |   |   |   |                           |   |   |
.     4   4   3   2 - 4 - 4 - 4 - 4 - 4 - 3 - 2   4   4
.     |   |   |                                   |   |
.     4   3   2 - 4 - 4 - 4 - 4 - 4 - 4 - 4 - 3 - 2   4
.     |   |                                           |
.     3   2 - 4 - 4 - 4 - 4 - 4 - 4 - 4 - 4 - 4 - 3 - 2
.     |
.     2 - 4 - 4 - 4 - 4 - 4 - 4 - 4 - 4 - 4 - 4 - 4 - 3
.
		

Crossrefs

Programs

  • Maple
    0,1,seq(op([2,4$floor(i/2),3]),i=0..30); # Robert Israel, Nov 22 2016

Formula

From Robert Israel, Nov 22 2016: (Start)
a(n) = 3 if n>=4 is in A002620.
a(n) = 2 if n>=2 is in A033638.
Otherwise, a(n) = 4 if n > 2. (End)

A094767 Square spiral of sums of selected preceding terms, starting at 1 (a spiral Fibonacci-like sequence).

Original entry on oeis.org

1, 1, 2, 4, 8, 13, 26, 40, 81, 123, 205, 412, 620, 1034, 2072, 3120, 5204, 8332, 16677, 25056, 41772, 66854, 133748, 200749, 334741, 535694, 870558, 1741321, 2612619, 4355177, 6968828, 11324625, 22650284, 33978635, 56635145, 90624176, 147267645
Offset: 1

Views

Author

Yasutoshi Kohmoto, Jun 10 2004

Keywords

Comments

Enter 1 into center position of the spiral. Repeat: Add to the number in the present position the numbers in all those already filled positions that are horizontally, vertically or diagonally adjacent to it, go to next position of the spiral and enter the sum into it.
a(1) = 1, a(n) = a(n-1) + Sum_{i < n-1 and a(i) is adjacent to a(n-1)} a(i).
Here eight positions are considered adjacent, only four however in A094768.
Clockwise and counterclockwise construction of the spiral result in the same sequence.

Examples

			Clockwise constructed spiral begins
.
  41772---66854--133748--200749--334741
      |
      |
      |
  25056      26------40------81-----123
      |       |                       |
      |       |                       |
      |       |                       |
  16677      13       1-------1     205
      |       |               |       |
      |       |               |       |
      |       |               |       |
   8332       8-------4-------2     412
      |                               |
      |                               |
      |                               |
   5204----3120----2072----1034-----620
.
where
  a(2) = a(1) = 1,
  a(3) = a(2) + a(1) = 2,
  a(4) = a(3) + a(2) + a(1) = 4,
  a(5) = a(4) + a(3) + a(2) + a(1) = 8,
  a(6) = a(5) + a(4) + a(1) = 13,
  a(7) = a(6) + a(5) + a(4) + a(1) = 26.
		

Crossrefs

Programs

  • PARI
    {m=5; h=2*m-1; A=matrix(h, h); print1(A[m, m]=1, ","); pj=m; pk=m; T=[[1, 0], [1, -1], [0, -1], [ -1, -1], [ -1, 0], [ -1, 1], [0, 1], [1, 1]]; for(n=1, (h-2)^2-1, g=sqrtint(n); r=(g+g%2)\2; q=4*r^2; d=n-q; if(n<=q-2*r, j=d+3*r; k=r, if(n<=q, j=r; k=-d-r, if(n<=q+2*r, j=r-d; k=-r, j=-r; k=d-3*r))); j=j+m; k=k+m; s=A[pj, pk]; for(c=1, 8, v=[pj, pk]; v+=T[c]; s=s+A[v[1], v[2]]); A[j, k]=s; print1(s, ","); pj=j; pk=k)} \\ Klaus Brockhaus, Aug 27 2008

Extensions

Edited and extended beyond a(14) by Klaus Brockhaus, Aug 27 2008

A094769 Square spiral of sums of selected preceding terms, starting at 0 followed by 1 (a spiral Fibonacci-like sequence).

Original entry on oeis.org

0, 1, 1, 2, 4, 6, 12, 18, 37, 56, 94, 189, 285, 475, 952, 1434, 2392, 3830, 7666, 11518, 19202, 30732, 61482, 92281, 153874, 246248, 400178, 800450, 1200967, 2001985, 3203426, 5205696, 10411867, 15619275, 26034003, 41658056, 67695885, 109356333
Offset: 1

Views

Author

Yasutoshi Kohmoto, Jun 10 2004

Keywords

Comments

Enter 0 into center position and 1 into next position of the spiral. Repeat: Add to the number in the present position the numbers in all those already filled positions that are horizontally, vertically or diagonally adjacent to it, go to next position of the spiral and enter the sum into it.
a(1) = 0, a(2) = 1, a(n) = a(n-1) + Sum_{i < n-1 and a(i) is adjacent to a(n-1)} a(i).
As in A094767 eight positions are considered adjacent here.
Clockwise and counterclockwise construction of the spiral result in the same sequence.

Examples

			Clockwise constructed spiral begins
.
  19202--30732--61482--92281-153874
      |
      |
  11518     12-----18-----37-----56
      |      |                    |
      |      |                    |
   7666      6      0------1     94
      |      |             |      |
      |      |             |      |
   3830      4------2------1    189
      |                           |
      |                           |
   2392---1434----952----475----285
.
where
  a(1) = 0,
  a(2) = 1,
  a(3) = a(2) + a(1) = 1,
  a(4) = a(3) + a(2) + a(1) = 2,
  a(5) = a(4) + a(3) + a(2) + a(1) = 4,
  a(6) = a(5) + a(4) + a(1) = 6,
  a(7) = a(6) + a(5) + a(4) + a(1) = 12.
		

Crossrefs

Programs

  • PARI
    {m=5; h=2*m-1; A=matrix(h, h); print1(A[m, m]=0, ","); print1(A[m, m+1]=1, ","); pj=m; pk=m+1; T=[[1, 0], [1, -1], [0, -1], [ -1, -1], [ -1, 0], [ -1, 1], [0, 1], [1, 1]]; for(n=2, (h-2)^2-1, g=sqrtint(n); r=(g+g%2)\2; q=4*r^2; d=n-q; if(n<=q-2*r, j=d+3*r; k=r, if(n<=q, j=r; k=-d-r, if(n<=q+2*r, j=r-d; k=-r, j=-r; k=d-3*r))); j=j+m; k=k+m; s=A[pj, pk]; for(c=1, 8, v=[pj, pk]; v+=T[c]; s=s+A[v[1], v[2]]); A[j, k]=s; print1(s, ","); pj=j; pk=k)} \\ Klaus Brockhaus, Aug 27 2008

Extensions

Edited and extended beyond a(12) by Klaus Brockhaus, Aug 27 2008

A094768 Square spiral of sums of selected preceding terms, starting at 1 (a spiral Fibonacci-like sequence).

Original entry on oeis.org

1, 1, 2, 3, 6, 9, 16, 25, 42, 68, 110, 179, 291, 470, 763, 1236, 2005, 3241, 5252, 8502, 13770, 22272, 36058, 58355, 94455, 152878, 247333, 400279, 647722, 1048180, 1696193, 2744373, 4440857, 7185700, 11627320, 18814256, 30443581, 49257837
Offset: 1

Views

Author

Yasutoshi Kohmoto, Jun 10 2004

Keywords

Comments

Enter 1 into center position of the spiral. Repeat: Add to the number in the present position the numbers in all those already filled positions that are horizontally or vertically adjacent to it, go to next position of the spiral and enter the sum into it.
a(1) = 1, a(n) = a(n-1) + Sum_{i < n-1 and a(i) is adjacent to a(n-1)} a(i).
Here only four positions are considered adjacent, eight however in A094767.
Clockwise and counterclockwise construction of the spiral result in the same sequence.

Examples

			Clockwise constructed spiral begins
.
  13770--22272--36058--58355--94455
      |
      |
   8502     16-----25-----42-----68
      |      |                    |
      |      |                    |
   5252      9      1------1    110
      |      |             |      |
      |      |             |      |
   3241      6------3------2    179
      |                           |
      |                           |
   2005---1236----763----470----291
.
where
  a(2) = a(1) = 1,
  a(3) = a(2) + a(1) = 2,
  a(4) = a(3) + a(2) = 3,
  a(5) = a(4) + a(3) + a(1) = 6,
  a(6) = a(5) + a(4) = 9,
  a(7) = a(6) + a(5) + a(1) = 16.
		

Crossrefs

Programs

  • PARI
    {m=5; h=2*m-1; A=matrix(h, h); print1(A[m, m]=1, ","); pj=m; pk=m; T=[[1, 0], [0, -1], [ -1, 0], [0, 1]]; for(n=1, (h-2)^2-1, g=sqrtint(n); r=(g+g%2)\2; q=4*r^2; d=n-q; if(n<=q-2*r, j=d+3*r; k=r, if(n<=q, j=r; k=-d-r, if(n<=q+2*r, j=r-d; k=-r, j=-r; k=d-3*r))); j=j+m; k=k+m; s=A[pj, pk]; for(c=1, 4, v=[pj, pk]; v+=T[c]; s=s+A[v[1], v[2]]); A[j, k]=s; print1(s, ","); pj=j; pk=k)} \\ Klaus Brockhaus, Aug 27 2008

Extensions

Edited and extended beyond a(14) by Klaus Brockhaus, Aug 27 2008

A278181 Hexagonal spiral constructed on the nodes of the triangular net in which each new term is the sum of its neighbors.

Original entry on oeis.org

1, 1, 2, 3, 4, 5, 7, 8, 9, 12, 14, 19, 22, 29, 33, 42, 47, 59, 74, 82, 99, 108, 129, 155, 169, 202, 243, 265, 316, 378, 411, 486, 575, 622, 728, 861, 1017, 1099, 1280, 1487, 1595, 1832, 2116, 2440, 2609, 2980, 3425, 3933, 4198, 4779, 5473, 6262, 6673, 7570, 8631, 9828, 10450, 11800, 13389, 15267, 17383
Offset: 0

Views

Author

Omar E. Pol, Nov 14 2016

Keywords

Comments

To evaluate a(n) consider the neighbors of a(n) that are present in the spiral when a(n) should be a new term in the spiral.

Examples

			Illustration of initial terms as a spiral:
.
.             22 - 19 - 14
.             /          \
.           29    3 - 2   12
.           /    /     \   \
.         33    4   1 - 1   9
.           \    \         /
.           42    5 - 7 - 8
.             \
.             47 - 59 - 74
.
a(16) = 47 because the sum of its two neighbors is 42 + 5 = 47.
a(17) = 59 because the sum of its three neighbors is 47 + 5 + 7 = 59.
a(18) = 74 because the sum of its three neighbors is 59 + 7 + 8 = 74.
a(19) = 82 because the sum of its two neighbors is 74 + 8 = 82.
		

Crossrefs

Programs

  • Mathematica
    A278181[0] = A278181[1] = 1; A278181[n_] := A278181[n] = With[{lev = Ceiling[1/6 (-3 + Sqrt[3] Sqrt[3 + 4 n])]}, With[{pos = 3 lev (lev - 1) + (n - 3 lev (1 + lev))/lev*(lev - 1)}, A278181[n - 1] + A278181[Ceiling[pos]] + If[Mod[n, lev] == 0 || n - 3 lev (lev - 1) == 1, 0, A278181[Floor[pos]]] + If[3 lev (1 + lev) == n, A278181[n - 6 lev + 1], 0]]]; Array[A278181, 61, 0] (* JungHwan Min, Nov 21 2016 *)

A334745 Starting with a(1) = a(2) = 1, proceed in a square spiral, computing each term as the sum of diagonally adjacent prior terms.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 3, 2, 3, 1, 1, 3, 2, 3, 1, 1, 3, 3, 3, 3, 1, 1, 3, 3, 3, 3, 1, 1, 4, 3, 6, 3, 4, 1, 1, 4, 3, 6, 3, 4, 1, 1, 4, 4, 6, 6, 4, 4, 1, 1, 4, 4, 6, 6, 4, 4, 1, 1, 5, 4, 10, 6, 10, 4, 5, 1, 1, 5, 4, 10, 6
Offset: 1

Views

Author

Alec Jones and Peter Kagey, May 09 2020

Keywords

Examples

			Spiral begins:
... 3---3---3---3---1
                    |
1---1---2---2---1   1
|               |   |
2   1---1---1   1   3
|   |       |   |   |
2   1   1---1   2   2
|   |           |   |
1   1---2---1---1   3
|                   |
1---3---2---3---1---1
The last illustrated term above is a(35) = 3 = 2 + 1 because diagonally down-right is 2 and diagonally down-left is 1.
		

Crossrefs

The x- and y-coordinates at n-th step are A174344 and A274923 respectively.

Formula

Conjecture: a(2n-1) = A247976(n).

A361374 Make a square spiral starting with a(1)=1, a(2)=2. Then, each position gets the smallest unused number which is the sum of a path of numbers starting from that position.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 74
Offset: 1

Views

Author

Samuel Harkness, Mar 28 2023

Keywords

Comments

A path can go in any cardinal direction or diagonal. A path may not repeat the same number.
For a while, this sequence seems to simply be the natural numbers. However, the percentage of natural numbers in this sequence tends to 0. E.g., only 2347 of the first million natural numbers are in this sequence.
a(73) = 72 is the first to break from the natural numbers. 97 is the least positive number which does not occur.

Examples

			For a(42), the first candidate to check is 42, as it is the least unused positive integer. 20-22 is a valid path which ends at a(42) and whose sum is 42, so a(42) = 42. (path shown below)
.
   37   36   35   34   33   32   31
.
   38   17   16   15   14   13   30
.
   39   18    5    4    3   12   29
.
   40   19    6    1    2   11   28
.
   41   20    7    8    9   10   27
.     /    \
 start  21   22   23   24   25   26
.
For a(73), the first candidate to check is 73, as it is the least unused positive integer. No paths starting at a(73) equal 73, so check the next candidate, 74. 43-21-7-1-2 is a valid path starting at a(73) and whose sum is 74, so a(73) = 74. (path shown below)
.
   65   64   63   62   61   60   59   58   57
.
   66   37   36   35   34   33   32   31   56
.
   67   38   17   16   15   14   13   30   55
.
   68   39   18    5    4    3   12   29   54
.
   69   40   19    6    1----2   11   28   53
.                     /
   70   41   20    7    8    9   10   27   52
.               /
   71   42   21   22   23   24   25   26   51
.          /
   72   43   44   45   46   47   48   49   50
      /
 start
.
The first 144 terms:
.
  164-162-159-155-153-152-151-149-148-147-146-158
                                                |
  102-100--99--96--94--93--92--91--90--89-101 154
    |                                       |   |
  103  65--64--63--62--61--60--59--58--57  98 150
    |   |                               |   |   |
  104  66  37--36--35--34--33--32--31  56  95 141
    |   |   |                       |   |   |   |
  105  67  38  17--16--15--14--13  30  55  85 140
    |   |   |   |               |   |   |   |   |
  106  68  39  18   5---4---3  12  29  54  84 139
    |   |   |   |   |       |   |   |   |   |   |
  107  69  40  19   6   1---2  11  28  53  82 135
    |   |   |   |   |           |   |   |   |   |
  108  70  41  20   7---8---9--10  27  52  81 134
    |   |   |   |                   |   |   |   |
  110  71  42  21--22--23--24--25--26  51  88 133
    |   |   |                           |   |   |
  112  72  43--44--45--46--47--48--49--50  87 138
    |   |                                   |   |
  114  74--73--75--76--77--78--79--80--83--86 137
    |                                           |
  117-116-118-119-120-121-122-124-126-128-132-136
.
Note that 97 does not (and will not) occur. A path must start with one of the outer-most cells, all of which are greater than 97, and nothing below their minimum can ever be reached again.
		

Crossrefs

Cf. A174344, A274923 (spiral coordinates).

Programs

  • MATLAB
    See Links section.

A358429 Construct a square spiral: a(n) is the sum of all adjacent terms a(k) in the spiral for k < n; a(1) = 0, a(2) = 1.

Original entry on oeis.org

0, 1, 1, 2, 2, 4, 4, 9, 10, 11, 23, 25, 26, 54, 59, 63, 65, 134, 144, 152, 156, 321, 344, 374, 395, 406, 835, 894, 968, 1019, 1045, 2144, 2283, 2459, 2646, 2774, 2839, 5812, 6155, 6585, 7037, 7345, 7501, 15323, 16144, 17183, 18296, 19471, 20272
Offset: 1

Views

Author

Abraham C Leventhal, Nov 15 2022

Keywords

Comments

The terms "adjacent" to a(n) are terms in any of the 8 cells of the matrix which surround the cell containing a(n). See Github link for code (Python 3) which produces the matrix and sequence, and a picture of the matrix containing the first 49 terms.

Examples

			The spiral begins:
.
   65--63--59--54--26
    |               |
  134   2---2---1  25
    |   |       |   |
  ...   4   0---1  23
        |           |
        4---9--10--11
.
The last term shown is a(18) = 134 = 65 + 63 + 2 + 4, which is the sum of its adjacent earlier terms.
		

Crossrefs

Showing 1-10 of 10 results.