A181390 Absolute difference between (sum of previous terms) and (n-th-odd square) with a(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
Links
- Vincenzo Librandi, Table of n, a(n) for n = 1..1000
- Index entries for linear recurrences with constant coefficients, signature (2,-1).
Programs
-
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 *)
-
PARI
a(n)=if(n>1,8*n-8,1) \\ Charles R Greathouse IV, Jul 31 2013
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
Extensions
Adapted g.f. to the offset from Bruno Berselli, Aug 01 2013