login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A317186 One of many square spiral sequences: a(n) = n^2 + n - floor((n-1)/2). 27
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 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,2

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.

LINKS

Table of n, a(n) for n=0..49.

Index entries for linear recurrences with constant coefficients, signature (2,0,-2,1).

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)

EXAMPLE

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

.

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 *)

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.

Sequence in context: A024521 A194455 A163324 * A048204 A259411 A058760

Adjacent sequences:  A317183 A317184 A317185 * A317187 A317188 A317189

KEYWORD

nonn,easy

AUTHOR

N. J. A. Sloane, Jul 27 2018

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 November 14 19:59 EST 2019. Contains 329128 sequences. (Running on oeis4.)