A248512 Sequence based on repeating in turn the subtract, add and multiply operations on the previous 2 terms, starting with 0, 1.
0, 1, 1, 2, 2, 0, 2, 0, -2, -2, 4, 6, 10, 60, 50, 110, 5500, 5390, 10890, 58697100, 58686210, 117383310, 6888781581155100, 6888781463771790, 13777563044926890, 94910620919839581404684194433100, 94910620919839567627121149506210
Offset: 1
Programs
-
Mathematica
nxt[{n_,a_,b_}]:={n+1,b,Which[Mod[n+1,3]==0,b-a,Mod[n+1,3] == 1,a+b,True,a*b]}; NestList[nxt,{2,0,1},30][[All,2]] (* Harvey P. Dale, Sep 20 2021 *)
Formula
For n > 2,
If n mod 3 = 0, a(n) = a(n-1) - a(n-2),
If n mod 3 = 1, a(n) = a(n-1) + a(n-2),
If n mod 3 = 2, a(n) = a(n-1) x a(n-2),
a(1) = 0, a(2) = 1.
Extensions
More terms from Colin Barker, Oct 08 2014
Edited: Name changed and keyword easy added - Wolfdieter Lang, Oct 29 2014
Changed name. - Jon Perry, Oct 29 2014
Comments