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

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A059924 Write the numbers from 1 to n^2 in a spiraling square; a(n) is the total of the sums of the two diagonals. 1
0, 2, 10, 34, 80, 158, 274, 438, 656, 938, 1290, 1722, 2240, 2854, 3570, 4398, 5344, 6418, 7626, 8978, 10480, 12142, 13970, 15974, 18160, 20538, 23114, 25898, 28896, 32118, 35570, 39262, 43200, 47394, 51850, 56578, 61584, 66878, 72466, 78358 (list; graph; refs; listen; history; internal format)
OFFSET

0,2

COMMENTS

If n is odd, n^2 is counted twice.

LINKS

Harry J. Smith, Table of n, a(n) for n=0,...,1000

Index to sequences with linear recurrences with constant coefficients, signature (3,-2,-2,3,-1).

FORMULA

a(n) = 3a(n-1)-2a(n-2)-2a(n-3)+3a(n-4)-a(n-5), a(0) = 0, a(1) = 2, a(2) = 10, a(3) = 34, a(4) = 80.

a(n) = (16*n^3 -6*n^2 +8*n +3 -3*(-1)^n)/12. - Frank Ellermann, Mar 16 2002

O.g.f.: (2*x+4*x^2+8*x^3+2*x^4)/(1-3*x+2*x^2+2*x^3-3*x^4+x^5)=(2*x+4*x^2+8*x^3+2*x^4)/((1-x)^4*(1+x)). [From Eric Werley (erw309(AT)lehigh.edu), Jun 30 2011]

EXAMPLE

Write the numbers from 1 to 16 like this:

.1 .2 .3 4

12 13 14 5

11 16 15 6

10 .9 .8 7

- the two diagonals add to 36 and 44, so a(4) = 36 + 44 = 80.

PROG

(PARI) { for (n=0, 1000, write("b059924.txt", n, " ", floor((16*n^3 - 6*n^2 + 8*n + 3 - 3*(-1^n))/12)); ) } [From Harry J. Smith (hjsmithh(AT)sbcglobal.net), Jun 30 2009]

CROSSREFS

Sequence in context: A036369 A043004 A108100 * A022498 A036799 A190161

Adjacent sequences:  A059921 A059922 A059923 * A059925 A059926 A059927

KEYWORD

easy,nice,nonn

AUTHOR

Fabian Rothelius (fabian.rothelius(AT)telia.com), Feb 10 2001

EXTENSIONS

Corrected and extended by Eric Werley (erw309(AT)lehigh.edu), Jun 30 2011

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Puzzles | Hot | Classics
Recent Additions | More pages | Superseeker | Maintained by The OEIS Foundation Inc.

Content is available under The OEIS End-User License Agreement .

Last modified February 16 15:53 EST 2012. Contains 205931 sequences.