login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A122592 a(n) = - a(n-1) + a(n-3) + (a(n-1) - a(n-2))^2 + (a(n-2) - a(n-3))^2. 4
1, 1, 1, 0, 2, 4, 4, 2, 6, 18, 144, 15882, 247684656, 61339821614663208, 3762573685332838515711641628032454, 14156960737559137644661747812427568488753428461913274274176986277422 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,5
LINKS
FORMULA
a(n) = a(n-1) - 2*a(n-1) + a(n-3) + (a(n-1) - a(n-2))^2 + (a(n-2) - a(n-3))^2, with a(1) = a(2) = a(3) = 1.
MATHEMATICA
(* First program *)
a[n_]:= a[n]= If[n<4, 1, -a[n-1] +a[n-3] +(a[n-1] -a[n-2])^2 +(a[n-2] -a[n-3])^2];
Table[a[n], {n, 20}]
(* Second program *)
RecurrenceTable[{a[1]==a[2]==a[3]==1, a[n]==-a[n-1]+a[n-3]+(a[n-2]-a[n-1])^2+(a[n-2]-a[n-3])^2}, a, {n, 20}] (* Harvey P. Dale, Dec 18 2012 *)
PROG
(Magma)
function a(n) // a = A122592
if n lt 4 then return 1;
else return -a(n-1) +a(n-3) +(a(n-1) -a(n-2))^2 +(a(n-2) -a(n-3))^2;
end if; return a; end function;
[a(n): n in [1..18]]; // G. C. Greubel, Nov 29 2021
(Sage)
@CachedFunction
def a(n): return 1 if (n<4) else -a(n-1) +a(n-3) +(a(n-1) -a(n-2))^2 +(a(n-2) -a(n-3))^2 # a = A122592
[a(n) for n in (1..18)] # G. C. Greubel, Nov 29 2021
CROSSREFS
Sequence in context: A206389 A206503 A323938 * A099264 A011172 A193028
KEYWORD
nonn
AUTHOR
Roger L. Bagula, Sep 19 2006
EXTENSIONS
Edited by N. J. A. Sloane, Sep 21 2006
Definition corrected by Harvey P. Dale, Dec 18 2012
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified July 18 21:02 EDT 2024. Contains 374388 sequences. (Running on oeis4.)