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-30 of 31 results. Next

A156859 The main column of a version of the square spiral.

Original entry on oeis.org

0, 3, 7, 14, 22, 33, 45, 60, 76, 95, 115, 138, 162, 189, 217, 248, 280, 315, 351, 390, 430, 473, 517, 564, 612, 663, 715, 770, 826, 885, 945, 1008, 1072, 1139, 1207, 1278, 1350, 1425, 1501, 1580, 1660, 1743, 1827, 1914, 2002, 2093, 2185, 2280, 2376, 2475, 2575
Offset: 0

Views

Author

Emilio Apricena (emilioapricena(AT)yahoo.it), Feb 17 2009

Keywords

Comments

This spiral is sometimes called an Ulam spiral, but square spiral is a better name. - N. J. A. Sloane, Jul 27 2018
It is easy to see that the only two primes in the sequence are 3, 7. Therefore the primes of the version of Ulam spiral are divided into four parts (see also A035608): northeast (NE), northwest (NW), southwest (SW), and southeast (SE).
Number of pairs (x,y) having x and y of opposite parity with x in {0,...,n} and y in {0,...,2n}. - Clark Kimberling, Jul 02 2012
Partial Sums of A014601(n). - Wesley Ivan Hurt, Oct 11 2013

Crossrefs

Cf. A000290, A000384, A004526, A014601 (first differences), A115258.
Sequences on the four axes of the square spiral: Starting at 0: A001107, A033991, A007742, A033954; starting at 1: A054552, A054556, A054567, A033951.
Sequences on the four diagonals of the square spiral: Starting at 0: A002939 = 2*A000384, A016742 = 4*A000290, A002943 = 2*A014105, A033996 = 8*A000217; starting at 1: A054554, A053755, A054569, A016754.
Sequences obtained by reading alternate terms on the X and Y axes and the two main diagonals of the square spiral: Starting at 0: A035608, A156859, A002378 = 2*A000217, A137932 = 4*A002620; starting at 1: A317186, A267682, A002061, A080335.

Programs

Formula

a(n) = n^2 + n + floor((n+1)/2) = A002378(n) + A004526(n+1) = A002620(n+1) + 3*A002620(n).
From R. J. Mathar, Feb 20 2009: (Start)
G.f.: x*(3+x)/((1+x)*(1-x)^3).
a(n) = 2*a(n-1) - 2*a(n-3) + a(n-4). (End)
a(n-1) = floor(n/(e^(1/n)-1)). - Richard R. Forberg, Jun 19 2013
a(n) = A000290(n+1) + A004526(-n-1). - Wesley Ivan Hurt, Jul 15 2013
a(n) + a(n+1) = A014105(n+1). - R. J. Mathar, Jul 15 2013
a(n) = floor(A000384(n+1)/2). - Bruno Berselli, Nov 11 2013
E.g.f.: (x*(5 + 2*x)*cosh(x) + (1 + 5*x + 2*x^2)*sinh(x))/2. - Stefano Spezia, Apr 24 2024
Sum_{n>=1} 1/a(n) = 4/9 + 2*log(2) - Pi/3. - Amiram Eldar, Apr 26 2024

Extensions

More terms added by Wesley Ivan Hurt, Oct 11 2013

A317186 One of many square spiral sequences: a(n) = n^2 + n - floor((n-1)/2).

Original entry on oeis.org

1, 2, 6, 11, 19, 28, 40, 53, 69, 86, 106, 127, 151, 176, 204, 233, 265, 298, 334, 371, 411, 452, 496, 541, 589, 638, 690, 743, 799, 856, 916, 977, 1041, 1106, 1174, 1243, 1315, 1388, 1464, 1541, 1621, 1702, 1786, 1871, 1959, 2048, 2140, 2233, 2329, 2426
Offset: 0

Views

Author

N. J. A. Sloane, Jul 27 2018

Keywords

Comments

Draw a square spiral on a piece of graph paper, and label the cells starting at the center with the positive (resp. nonnegative) numbers. This produces two versions of the labeled square spiral, shown in the Example section below.
The spiral may proceed clockwise or counterclockwise, and the first arm of the spiral may be along any of the four axes, so there are eight versions of each spiral. However, this has no effect on the resulting sequences, and it is enough to consider just two versions of the square spiral (starting at 1 or starting at 0).
The present sequence is obtained by reading alternate entries on the X-axis (say) of the square spiral started at 1.
The cross-references section lists many sequences that can be read directly off the two spirals. Many other sequences can be obtained from them by using them to extract subsequences from other important sequences. For example, the subsequence of primes indexed by the present sequence gives A317187.
a(n) is also the number of free polyominoes with n + 4 cells whose difference between length and width is n. In this comment the length is the longer of the two dimensions and the width is the shorter of the two dimensions (see the examples of polyominoes). Hence this is also the diagonal 4 of A379625. - Omar E. Pol, Jan 24 2025
From John Mason, Feb 19 2025: (Start)
The sequence enumerates polyominoes of width 2 having precisely 2 horizontal bars. By classifying such polyominoes according to the following templates, it is possible to define a formula that reduces to the one below:
.
OO O O
O OO OO
O O O
O O OO
OO OO O
.
(End)

Examples

			The square spiral when started with 1 begins:
.
  100--99--98--97--96--95--94--93--92--91
                                        |
   65--64--63--62--61--60--59--58--57  90
    |                               |   |
   66  37--36--35--34--33--32--31  56  89
    |   |                       |   |   |
   67  38  17--16--15--14--13  30  55  88
    |   |   |               |   |   |   |
   68  39  18   5---4---3  12  29  54  87
    |   |   |   |       |   |   |   |   |
   69  40  19   6   1---2  11  28  53  86
    |   |   |   |           |   |   |   |
   70  41  20   7---8---9--10  27  52  85
    |   |   |                   |   |   |
   71  42  21--22--23--24--25--26  51  84
    |   |                           |   |
   72  43--44--45--46--47--48--49--50  83
    |                                   |
   73--74--75--76--77--78--79--80--81--82
.
For the square spiral when started with 0, subtract 1 from each entry. In the following diagram this spiral has been reflected and rotated, but of course that makes no difference to the sequences:
.
   99  64--65--66--67--68--69--70--71--72
    |   |                               |
   98  63  36--37--38--39--40--41--42  73
    |   |   |                       |   |
   97  62  35  16--17--18--19--20  43  74
    |   |   |   |               |   |   |
   96  61  34  15   4---5---6  21  44  75
    |   |   |   |   |       |   |   |   |
   95  60  33  14   3   0   7  22  45  76
    |   |   |   |   |   |   |   |   |   |
   94  59  32  13   2---1   8  23  46  77
    |   |   |   |           |   |   |   |
   93  58  31  12--11--10---9  24  47  78
    |   |   |                   |   |   |
   92  57  30--29--28--27--26--25  48  79
    |   |                           |   |
   91  56--55--54--53--52--51--50--49  80
    |                                   |
   90--89--88--87--86--85--84--83--82--81
.
From _Omar E. Pol_, Jan 24 2025: (Start)
For n = 0 there is only one free polyomino with 0 + 4 = 4 cells whose difference between length and width is 0 as shown below, so a(0) = 1.
   _ _
  |_|_|
  |_|_|
.
For n = 1 there are two free polyominoes with 1 + 4 = 5 cells whose difference between length and width is 1 as shown below, so a(1) = 2.
   _ _     _ _
  |_|_|   |_|_|
  |_|_|   |_|_
  |_|     |_|_|
.
(End)
		

Crossrefs

Sequences on the four axes of the square spiral: Starting at 0: A001107, A033991, A007742, A033954; starting at 1: A054552, A054556, A054567, A033951.
Sequences on the four diagonals of the square spiral: Starting at 0: A002939 = 2*A000384, A016742 = 4*A000290, A002943 = 2*A014105, A033996 = 8*A000217; starting at 1: A054554, A053755, A054569, A016754.
Sequences obtained by reading alternate terms on the X and Y axes and the two main diagonals of the square spiral: Starting at 0: A035608, A156859, A002378 = 2*A000217, A137932 = 4*A002620; starting at 1: A317186, A267682, A002061, A080335.
Filling in these two squares spirals with greedy algorithm: A274640, A274641.
Cf. also A317187.

Programs

  • Mathematica
    a[n_] := n^2 + n - Floor[(n - 1)/2]; Array[a, 50, 0] (* Robert G. Wilson v, Aug 01 2018 *)
    LinearRecurrence[{2, 0, -2 , 1},{1, 2, 6, 11},50] (* or *)
    CoefficientList[Series[(- x^3 - 2 * x^2 - 1) / ((x - 1)^3 * (x + 1)), {x, 0, 50}], x] (* Stefano Spezia, Sep 02 2018 *)

Formula

From Daniel Forgues, Aug 01 2018: (Start)
a(n) = (1/4) * (4 * n^2 + 2 * n + (-1)^n + 3), n >= 0.
a(0) = 1; a(n) = - a(n-1) + 2 * n^2 - n + 2, n >= 1.
a(0) = 1; a(1) = 2; a(2) = 6; a(3) = 11; a(n) = 2 * a(n-1) - 2 * a(n-3) + a(n-4), n >= 4.
G.f.: (- x^3 - 2 * x^2 - 1) / ((x - 1)^3 * (x + 1)). (End)
E.g.f.: ((2 + 3*x + 2*x^2)*cosh(x) + (1 + 3*x + 2*x^2)*sinh(x))/2. - Stefano Spezia, Apr 24 2024
a(n)+a(n+1)=A033816(n). - R. J. Mathar, Mar 21 2025
a(n)-a(n-1) = A042948(n), n>=1. - R. J. Mathar, Mar 21 2025

A267682 a(n) = 2*a(n-1) - 2*a(n-3) + a(n-4) for n > 3, with initial terms 1, 1, 4, 8.

Original entry on oeis.org

1, 1, 4, 8, 15, 23, 34, 46, 61, 77, 96, 116, 139, 163, 190, 218, 249, 281, 316, 352, 391, 431, 474, 518, 565, 613, 664, 716, 771, 827, 886, 946, 1009, 1073, 1140, 1208, 1279, 1351, 1426, 1502, 1581, 1661, 1744, 1828, 1915, 2003, 2094, 2186, 2281, 2377, 2476
Offset: 0

Views

Author

Robert Price, Jan 19 2016

Keywords

Comments

Also, total number of ON (black) cells after n iterations of the "Rule 201" elementary cellular automaton starting with a single ON (black) cell.

References

  • S. Wolfram, A New Kind of Science, Wolfram Media, 2002; p. 55.

Crossrefs

Cf. A267679.
Sequences on the four axes of the square spiral: Starting at 0: A001107, A033991, A007742, A033954; starting at 1: A054552, A054556, A054567, A033951.
Sequences on the four diagonals of the square spiral: Starting at 0: A002939 = 2*A000384, A016742 = 4*A000290, A002943 = 2*A014105, A033996 = 8*A000217; starting at 1: A054554, A053755, A054569, A016754.
Sequences obtained by reading alternate terms on the X and Y axes and the two main diagonals of the square spiral: Starting at 0: A035608, A156859, A002378 = 2*A000217, A137932 = 4*A002620; starting at 1: A317186, A267682, A002061, A080335.

Programs

  • Mathematica
    rule=201; rows=20; ca=CellularAutomaton[rule,{{1},0},rows-1,{All,All}]; (* Start with single black cell *) catri=Table[Take[ca[[k]],{rows-k+1,rows+k-1}],{k,1,rows}]; (* Truncated list of each row *) nbc=Table[Total[catri[[k]]],{k,1,rows}]; (* Number of Black cells in stage n *) Table[Total[Take[nbc,k]],{k,1,rows}] (* Number of Black cells through stage n *)
    LinearRecurrence[{2, 0, -2, 1}, {1, 1, 4, 8}, 60] (* Vincenzo Librandi, Jan 19 2016 *)
  • PARI
    Vec((1-x+2*x^2+2*x^3)/((1-x)^3*(1+x)) + O(x^100)) \\ Colin Barker, Jan 19 2016
    
  • Python
    print([n*(n-1)+n//2+1 for n in range(51)]) # Karl V. Keller, Jr., Jul 14 2021

Formula

G.f.: (1 - x + 2*x^2 + 2*x^3) / ((1-x)^3*(1+x)). - Colin Barker, Jan 19 2016
a(n) = n*(n-1) + floor(n/2) + 1. - Karl V. Keller, Jr., Jul 14 2021
E.g.f.: (exp(x)*(2 + x + 2*x^2) - sinh(x))/2. - Stefano Spezia, Jul 16 2021

Extensions

Edited by N. J. A. Sloane, Jul 25 2018, replacing definition with simpler formula provided by Colin Barker, Jan 19 2016.

A081353 Diagonal of square maze arrangement of natural numbers A081349.

Original entry on oeis.org

3, 5, 13, 19, 31, 41, 57, 71, 91, 109, 133, 155, 183, 209, 241, 271, 307, 341, 381, 419, 463, 505, 553, 599, 651, 701, 757, 811, 871, 929, 993, 1055, 1123, 1189, 1261, 1331, 1407, 1481, 1561, 1639, 1723, 1805, 1893, 1979, 2071, 2161, 2257, 2351, 2451, 2549
Offset: 0

Views

Author

Paul Barry, Mar 19 2003

Keywords

Crossrefs

Bisections are in A054554, A125202.

Programs

Formula

a(n) = (n+1)*(n+2)+(-1)^n = 2*binomial(n+2,2)+(-1)^n.
G.f.: (3-x)*(1+x^2)/((1-x)^3*(1+x)). [Colin Barker, Sep 03 2012]
From Wesley Ivan Hurt, Aug 09 2015: (Start)
a(n) = 2*a(n-1)-2*a(n-3)+a(n-4), n>4.
a(n) = n^2+3n+3 if n is even, otherwise n^2+3n+1.
a(n) = A137932(n+3) - A109613(n+1). (End)

A213041 Number of triples (w,x,y) with all terms in {0..n} and 2*|w-x| = max(w,x,y) - min(w,x,y).

Original entry on oeis.org

1, 2, 7, 12, 21, 30, 43, 56, 73, 90, 111, 132, 157, 182, 211, 240, 273, 306, 343, 380, 421, 462, 507, 552, 601, 650, 703, 756, 813, 870, 931, 992, 1057, 1122, 1191, 1260, 1333, 1406, 1483, 1560, 1641, 1722, 1807, 1892, 1981, 2070, 2163, 2256
Offset: 0

Views

Author

Clark Kimberling, Jun 10 2012

Keywords

Comments

See A212959 for a guide to related sequences.
For n > 3, a(n-2) is the number of distinct values of the magic constant in a perimeter-magic (n-1)-gon of order n (see A342819). - Stefano Spezia, Mar 23 2021

Crossrefs

Cf. A002620, A004526, A058331, A212959, A168277 (first differences), A342819.

Programs

  • Mathematica
    t = Compile[{{n, _Integer}}, Module[{s = 0},
    (Do[If[Max[w, x, y] - Min[w, x, y] == 2 Abs[w - x],
    s = s + 1],
    {w, 0, n}, {x, 0, n}, {y, 0, n}]; s)]];
    m = Map[t[#] &, Range[0, 45]]   (* A213041 *)
  • PARI
    Vec((1+3*x^2)/((1-x)^3*(1+x)) + O(x^99)) \\ Altug Alkan, May 06 2016

Formula

a(n) = 2*a(n-1) - 2*a(n-3) + a(n-4) for n > 3.
G.f.: (1 + 3*x^2)/((1 - x)^3 * (1 + x)).
a(n) = (n+1)^2 - 2*A004526(n-1) - 2. - Wesley Ivan Hurt, Jul 15 2013
a(n) = A002620(n+2) + 3*A002620(n). - R. J. Mathar, Jul 15 2013
a(n)+a(n+1) = A058331(n+1). - R. J. Mathar, Jul 15 2013
a(n) = n*(n+1) + (1+(-1)^n)/2. - Wesley Ivan Hurt, May 06 2016
E.g.f.: x*(x + 2)*exp(x) + cosh(x). - Ilya Gutkovskiy, May 06 2016
a(n) = A000384(n+1) - A137932(n+2). - Federico Provvedi, Aug 17 2023

A267089 T(n,k) is decimal conversion of 1's in an n X n table that lie on its principal diagonals.

Original entry on oeis.org

1, 3, 3, 5, 2, 5, 9, 6, 6, 9, 17, 10, 4, 10, 17, 33, 18, 12, 12, 18, 33, 65, 34, 20, 8, 20, 34, 65, 129, 66, 36, 24, 24, 36, 66, 129, 257, 130, 68, 40, 16, 40, 68, 130, 257, 513, 258, 132, 72, 48, 48, 72, 132, 258, 513, 1025, 514, 260, 136, 80, 32, 80, 136, 260, 514
Offset: 0

Views

Author

Kival Ngaokrajang, Jan 10 2016

Keywords

Comments

Inspired by A137932 and A042948.
Conjectures:
(i) The first column is A083318.
(ii) T(n,k) = A086066(m) where m >= 10, n = m - 9*k, k = floor(m/10).

Examples

			See the "Illustration of initial terms" link for explicit examples.
Triangle begins:
n\k 0   1  2  3  4  5  6   7   8 ...
0   1
1   3   3
2   5   2  5
3   9   6  6  9
4  17  10  4 10 17
5  33  18 12 12 18 33
6  65  34 20  8 20 34 65
7 129  66 36 24 24 36 66 129
8 257 130 68 40 16 40 68 130 257
...
		

Crossrefs

A267489 a(n) = n^2 - 4*floor(n^2/6).

Original entry on oeis.org

0, 1, 4, 5, 8, 9, 12, 17, 24, 29, 36, 41, 48, 57, 68, 77, 88, 97, 108, 121, 136, 149, 164, 177, 192, 209, 228, 245, 264, 281, 300, 321, 344, 365, 388, 409, 432, 457, 484, 509, 536, 561, 588, 617, 648, 677, 708, 737, 768, 801, 836, 869, 904
Offset: 0

Views

Author

Kival Ngaokrajang, Jan 16 2016

Keywords

Comments

Inspired by A137932 and A042948.
The pattern is generated by adding subdiagonals parallel to principal diagonals at a spacing of at least 1 box in any direction from the previous generation.
Conjectures:
(i) a(n) is the total number of boxes (or 1's) at the n-th iteration.
(ii) The total number of left boxes (or 0's) is 4*A056827.

Crossrefs

Programs

  • Magma
    [0] cat [n^2-4*Floor(n^2/6): n in [1..70]]; // Vincenzo Librandi, Jan 16 2016
  • Maple
    A267489:=n->n^2-4*floor(n^2/6): seq(A267489(n), n=0..100); # Wesley Ivan Hurt, Apr 11 2017
  • Mathematica
    Table[n^2 - 4 Floor[n^2 / 6], {n, 0, 70}] (* Vincenzo Librandi, Jan 16 2016 *)
  • PARI
    for (n = 0, 100, a = n^2-4*floor(n^2/6); print1(a, ", "))
    
  • PARI
    concat(0, Vec(x*(1+2*x-2*x^2+2*x^3-2*x^4+2*x^5+x^6)/((1-x)^3*(1+x)*(1-x+x^2)*(1+x+x^2)) + O(x^100))) \\ Colin Barker, Jan 16 2016
    
  • PARI
    a(n)=n^2 - n^2\6*4 \\ Charles R Greathouse IV, Mar 22 2017
    

Formula

a(n) = n^2 - 4*floor(n^2/6) for n >= 0.
From Colin Barker, Jan 16 2016: (Start)
a(n) = 2*a(n-1) - a(n-2) + a(n-6) - 2*a(n-7) + a(n-8) for n>7.
G.f.: x*(1+2*x-2*x^2+2*x^3-2*x^4+2*x^5+x^6) / ((1-x)^3*(1+x)*(1-x+x^2)*(1+x+x^2)).
(End)

A279403 Irregular triangle read by rows: T(n,k) (n>=1, 0 <= k <= n^2) = minimal number of squares not attacked by k queens on an n X n toroidal board, with trailing zeros truncated.

Original entry on oeis.org

1, 4, 9, 16, 4, 25, 8, 2, 36, 16, 4, 49, 24, 11, 4, 64, 36, 16, 6, 81, 48, 27, 12, 3, 100, 64, 36, 19, 4, 121, 80, 51, 29, 13, 144, 100, 64, 39, 16, 6, 169, 120, 83, 53, 29, 8, 2, 196, 144, 100, 67, 36, 18, 8, 225, 168, 223, 82, 41, 256, 196, 144, 103, 64, 40
Offset: 1

Views

Author

Andrey Zabolotskiy, Dec 11 2016

Keywords

Comments

Row lengths are A279402.

Examples

			The triangle begins:
1 (0)
4 (0, 0, 0, 0)
9 (0, 0, ...)
16 4 (0, 0, ...)
25 8 2
36 16 4
49 24 11 4
64 36 16 6
81 48 27 12 3
100 64 36 19 4
121 80 51 29 13
144 100 64 39 16 6
169 120 83 53 29 8 2
196 144 100 67 36 18 8
225 168 123 82 41
256 196 144 103 64 40 ...
		

Crossrefs

Formula

T(n,0) = A000290(n).
T(n,1) = A000290(n)-A047461(n) = A137932(n-1).
T(n,2) = A248825(n-4) for n >= 6.

A267090 Triangle read by rows: Fill an n X n square with 1's, except for 0's on the two main diagonals. Then T(n,k) is decimal equivalent of the k-th row (0<=k<=n).

Original entry on oeis.org

0, 0, 0, 2, 5, 2, 6, 9, 9, 6, 14, 21, 27, 21, 14, 30, 45, 51, 51, 45, 30, 62, 93, 107, 119, 107, 93, 62, 126, 189, 219, 231, 231, 219, 189, 126, 254, 381, 443, 471, 495, 471, 443, 381, 254, 510, 765, 891, 951, 975, 975, 951, 891, 765, 510
Offset: 0

Views

Author

Kival Ngaokrajang, Jan 10 2016

Keywords

Comments

Inspired by A137932 and A042948.
Conjectures:
(i) The first column is A000225/2.
(ii) For even-n, T(n,n/2) = A129868.
(iii) For odd-n, T(n,(n-1)/2) = T(n,(n+1)/2) = A220236.

Examples

			Triangle begins:
n\k  0   1   2   3   4   5   6   7   8 ...
0    0
1    0   0
2    2   5   2
3    6   9   9   6
4   14  21  27  21  14
5   30  45  51  51  45  30
6   62  93 107 119 107  93  62
7  126 189 219 231 231 219 189 126
8  254 381 443 471 495 471 443 381 254
...
		

Crossrefs

A301648 Number of longest cycles in the n X n grid graph.

Original entry on oeis.org

0, 1, 5, 6, 226, 1072, 255088, 4638576, 6663430912, 467260456608, 3916162476483538, 1076226888605605706, 51249820944023435573470, 56126499620491437281263608, 14870957102232406137455708164254, 65882516522625836326159786165530572, 95494789899510664733921727510895952184006
Offset: 1

Views

Author

Eric W. Weisstein, Mar 25 2018

Keywords

Comments

a(10) = 467260456608.

Crossrefs

Cf. A137932 (circumference of the (n-1) X (n-1) grid graph).
Cf. A003763 (number of Hamiltonian cycles in the 2n X 2n grid graph).
Cf. A181584 (number of longest cycles in the (2n+1) X (2n+1) grid graph).

Formula

a(2n) = A003763(n).
a(2n+1) = A181584(n). - Andrew Howroyd, Mar 01 2020

Extensions

Terms a(9) and beyond from Andrew Howroyd, Mar 01 2020
Previous Showing 21-30 of 31 results. Next