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.

Previous Showing 21-26 of 26 results.

A334741 Fill an infinite square array by following a spiral around the origin; in the central cell enter a(0)=1; thereafter, in the n-th cell, enter the sum of the entries of those earlier cells that are in the same row or column as that cell.

Original entry on oeis.org

1, 1, 1, 2, 3, 5, 8, 11, 21, 40, 47, 93, 180, 203, 397, 796, 1576, 1675, 3305, 6636, 13192, 14004, 27607, 55029, 110192, 220024, 226740, 450123, 898661, 1798700, 3594248, 3704800, 7354303, 14681369, 29349536, 58710640, 117394896, 119196748, 237492079
Offset: 0

Views

Author

Alec Jones and Peter Kagey, May 09 2020

Keywords

Comments

The spiral track being used here is the same as in A274640, except that the starting cell here is indexed 0 (as in A274641).
The central cell gets index 0 (and we fill it in with the value a(0)=1).

Examples

			Spiral begins:
     3----2----1
     |         |
     5    1----1   47
     |              |
     8---11---21---40
a(11) = 47 = 1 + 1 + 5 + 40, the sum of the cells in its row and column.
		

Crossrefs

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

Programs

  • PARI
    \\ here P(n) returns A174344 and A274923 as pair.
    P(n)={my(m=sqrtint(n), k=ceil(m/2)); n -= 4*k^2; if(n<0, if(n<-m, [k, 3*k+n], [-k-n, k]), if(nAndrew Howroyd, May 09 2020

A225590 Primes p such that A217015(p) is a prime number. That is, when applying the walk of a square spiral to the data of rotated-square spiral, on step p a prime number is hit.

Original entry on oeis.org

2, 11, 17, 23, 53, 61, 67, 139, 149, 151, 163, 251, 263, 269, 281, 397, 421, 431, 541, 547, 557, 607, 619, 743, 773, 809, 1021, 1039, 1229, 1279, 1291, 1303, 1361, 1553, 1601, 1619, 1637, 1871, 1901, 1949, 2003, 2239, 2251, 2267, 2281, 2287, 2309, 2311, 2347, 2381, 2393
Offset: 1

Views

Author

Alex Ratushnyak, May 15 2013

Keywords

Comments

Corresponding primes with prime indices, in sorted order: A225754.

Crossrefs

A225754 Primes p such that A217296(p) is a prime number. That is, when applying the walk of rotated-square spiral to the data of square spiral, on step p a prime number is hit.

Original entry on oeis.org

5, 11, 13, 29, 31, 41, 67, 71, 73, 79, 127, 137, 193, 199, 211, 293, 313, 421, 499, 503, 619, 631, 647, 661, 673, 773, 811, 967, 991, 1013, 1129, 1163, 1553, 1567, 1597, 1601, 1607, 1747, 1777, 1783, 1789, 1801, 1831, 1861, 1997, 2039, 2053, 2087, 2099, 2113, 2287, 2311
Offset: 1

Views

Author

Alex Ratushnyak, May 15 2013

Keywords

Comments

Corresponding primes with prime indices, in sorted order: A225590. The intersection of a(n) with A225590 begins: 11, 67, 421, 619, 773, 1553, 1601, 2287, 2311, 2381, 2609, 3169, 3181, 3491, 3511, 4157, 4597, 4639, 6263, 7129, 7177, 7193, 8291, 9277.

Crossrefs

A235913 a(n) is the Manhattan distance between n^3 and (n+1)^3 in a square spiral of positive integers with 1 at the center.

Original entry on oeis.org

1, 3, 11, 15, 13, 9, 5, 21, 33, 59, 71, 49, 47, 35, 15, 13, 43, 73, 109, 123, 117, 109, 167, 141, 113, 77, 43, 5, 51, 95, 145, 201, 263, 281, 397, 413, 317, 333, 269, 239, 183, 121, 63, 11, 81, 147, 219, 307, 379, 471, 567, 623, 517, 569, 683, 503, 545, 473, 395, 311
Offset: 1

Views

Author

Alex Ratushnyak, Jan 16 2014

Keywords

Comments

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

Examples

			Manhattan distance between 2^3=8 and 3^3=27 is 3 in a square spiral, so a(2)=3.
		

Crossrefs

Programs

  • Python
    import math
    def get_x_y(n):
      sr = int(math.sqrt(n-1))  # Ok for small n's
      sr = sr-1+(sr&1)
      rm = n-sr*sr
      d = (sr+1)//2
      if rm<=sr+1:
         return -d+rm, d
      if rm<=sr*2+2:
         return d, d-(rm-(sr+1))
      if rm<=sr*3+3:
         return d-(rm-(sr*2+2)), -d
      return -d, -d+rm-(sr*3+3)
    for n in range(1, 77):
      x0, y0 = get_x_y(n**3)
      x1, y1 = get_x_y((n+1)**3)
      print(abs(x1-x0)+abs(y1-y0), end=', ')

A277214 a(n) is the Manhattan distance between n and 1 in a 3-dimensional cubic spiral of positive integers with 1..8 at the center (illustration in the comments).

Original entry on oeis.org

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

Views

Author

Alex Ratushnyak, Oct 05 2016

Keywords

Comments

Similar to A214526, but three-dimensional, and the core is 2 X 2 X 2 rather than 1 X 1.
The spiral begins as follows:
Level z=-2:
95 94 93 92 91 90
96 77 76 75 74 89
97 78 67 66 73 88
98 79 68 65 72 87
99 80 69 70 71 86
100 81 82 83 84 85
z=-1:
116 115 114 113 112 111
117 52 51 50 49 110
118 53 62 61 60 109
119 54 63 64 59 108
120 55 56 57 58 107
101 102 103 104 105 106
z=0:
137 136 135 134 133 132
138 39 38 37 48 131
139 40 3 2 47 130
140 41 4 1 46 129
121 42 43 44 45 128
122 123 124 125 126 127
z=1:
144 145 146 147 148 149
143 34 35 36 25 150
142 33 6 7 26 151
141 32 5 8 27 152
160 31 30 29 28 153
159 158 157 156 155 154
z=2:
165 166 167 168 169 170
164 21 22 23 24 171
163 20 11 12 13 172
162 19 10 9 14 173
161 18 17 16 15 174
180 179 178 177 176 175
z=3:
186 187 188 189 190 191
185 204 205 206 207 192
184 203 214 215 208 193
183 202 213 216 209 194
182 201 212 211 210 195
181 200 199 198 197 196
Algorithm sketch:
1. At every x-y plane the direction is clockwise if z > 0 and counterclockwise if z <= 0.
2. After an N*N cube is complete and we start building an M*M cube, M=N+2:
2a. The spiral at the first new edge of the M*M cube progresses from center to edges, in the same way as the A214526 spiral, e.g., z=-2 in the illustration.
2b. Between the first and last z-edges the spiral progresses according to item 1.
2c. The spiral at the last new edge of the M*M cube progresses from edges to center, e.g., z=3 in the illustration.

Crossrefs

Cf. A214526.

Formula

abs( a(n) - a(n-1) ) = 1.

A368643 Manhattan distance from the origin of triangular number point T(n) = n*(n+1)/2 in a square spiral with point 0 at the origin.

Original entry on oeis.org

0, 1, 1, 2, 2, 3, 3, 4, 6, 3, 7, 6, 6, 9, 5, 10, 8, 9, 11, 8, 14, 9, 13, 12, 12, 17, 9, 18, 14, 15, 19, 12, 22, 15, 19, 20, 16, 25, 15, 24, 20, 21, 27, 16, 30, 21, 25, 28, 20, 35, 21, 30, 28, 25, 35, 20, 36, 27, 31, 36, 24, 43, 27, 36, 36, 29, 45, 26, 42, 35, 35, 44, 28, 49, 33, 42, 44, 33, 55, 32, 48, 43, 39, 54, 30
Offset: 0

Views

Author

Tamas Sandor Nagy, Jan 01 2024

Keywords

Examples

			Showing the Manhattan distance for a(4), that is, from the origin to the fourth triangular number T(4) = 10, as being 2:
  +----15-----+-----+-----+     +
  |                       |     |
  |                       |     |
  +     +-----3-----+     +    28
  |     |           |     |     |
  |     |           |     |     |
  +     +     0-----1    10     +
  |     |     ^---a(4)=2--^     |
  |     |                 |     |
  +     6-----+-----+-----+     +
  |                             |
  |                             |
  +----21-----+-----+-----+-----+
		

Crossrefs

Formula

a(n) = A214526(n*(n+1)/2 + 1).
Previous Showing 21-26 of 26 results.