|
Search: id:A059924
|
|
|
| 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. |
|
+0 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; listen)
|
|
|
OFFSET
|
0,2
|
|
|
COMMENT
|
If n is odd, n^2 is counted twice.
|
|
LINKS
|
Harry J. Smith, Table of n, a(n) for n=0,...,1000
|
|
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(3) = 10, a(4) = 34, a(5) = 80.
a(n) = ( 16*n*n*n -6*n*n +8*n +3 -3*(-1^n) ) / 12. - Frank Ellermann, Mar 16 2002
|
|
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.
|
|
PROGRAM
|
(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 this_sequence A022498 A036799 A119193
Adjacent sequences: A059921 A059922 A059923 this_sequence A059925 A059926 A059927
|
|
KEYWORD
|
easy,nice,nonn
|
|
AUTHOR
|
Fabian Rothelius (fabian.rothelius(AT)telia.com), Feb 10 2001
|
|
|
Search completed in 0.002 seconds
|