login
A181390
Absolute difference between (sum of previous terms) and (n-th-odd square) with a(1) = 1.
1
1, 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, 128, 136, 144, 152, 160, 168, 176, 184, 192, 200, 208, 216, 224, 232, 240, 248, 256, 264, 272, 280, 288, 296, 304, 312, 320, 328, 336, 344, 352, 360, 368, 376, 384, 392, 400, 408, 416, 424
OFFSET
1,3
FORMULA
a(n) = 8*(n-2) = A008590(n-2), n>1. - R. J. Mathar, Oct 18 2010
G.f.: x*(1 - 2*x + 9*x^2)/(-1 + x)^2. -Alexander R. Povolotsky, Oct 18 2010
a(1)=1, a(2)=0, a(3)=8, a(n)=2*a(n-1)-a(n-2). -Harvey P. Dale, Aug 23 2012
E.g.f.: 16 + 9*x + 8*exp(x)*(x - 2). - Stefano Spezia, Apr 03 2023
MATHEMATICA
Module[{lst={1}}, Do[AppendTo[lst, Abs[Total[lst]-n^2]], {n, 1, 111, 2}]; lst] (* or *) Join[{1}, LinearRecurrence[{2, -1}, {0, 8}, 60]] (* Harvey P. Dale, Aug 23 2012 *)
ad[{t_, n_, a_}]:=Module[{c=Abs[t-(2n-1)^2]}, {t+c, n+1, c}]; NestList[ad, {1, 1, 1}, 60][[All, 3]] (* or *) Join[{1}, NestList[8 + # &, 0, 60]] (* Harvey P. Dale, May 14 2019 *)
PROG
(PARI) a(n)=if(n>1, 8*n-8, 1) \\ Charles R Greathouse IV, Jul 31 2013
CROSSREFS
Sequence in context: A387326 A185359 A365886 * A008590 A022144 A186544
KEYWORD
nonn,easy
AUTHOR
Giovanni Teofilatto, Oct 17 2010
EXTENSIONS
Adapted g.f. to the offset from Bruno Berselli, Aug 01 2013
STATUS
approved