OFFSET
1,3
COMMENTS
If S(n)=a(4n-1) (i.e., term "+"), R(n)=a(4n) (i.e., "-"), P(n)=a(4n+1), D(n)=a(4n+2) then D(n)=S(n), P(n)=S(n+1)-S(n), R(n+1)=P(n)=S(n+1)-S(n). - Jose Ramon Real, Nov 10 2007
EXAMPLE
a(3) = a(2) + a(1) = 1 + 1 = 2;
a(4) = a(3) - a(2) = 2 - 1 = 1;
a(5) = a(4) * a(3) = 1 * 2 = 2;
a(6) = a(5) / a(4) = 2 / 1 = 2.
MAPLE
A131183 := proc(n) option remember ; if n <= 2 then 1 ; elif n mod 4 = 3 then A131183(n-1)+A131183(n-2) ; elif n mod 4 = 0 then A131183(n-1)-A131183(n-2) ; elif n mod 4 = 1 then A131183(n-1)*A131183(n-2) ; else A131183(n-1)/A131183(n-2) ; fi ; end: seq(A131183(n), n=1..35) ; # R. J. Mathar, Oct 28 2007
MATHEMATICA
a[1]=a[2]=1; a[n_] := a[n] = Switch[Mod[n, 4], 3, a[n-1]+a[n-2], 0, a[n-1]-a[n-2], 1, a[n-1]*a[n-2], 2, a[n-3]]; Array[a, 30] (* Jean-François Alcover, Dec 28 2015 *)
nxt[{n_, a_, b_}]:=Module[{m=Mod[n+1, 4]}, {n+1, b, Which[m==3, a+b, m==0, b-a, m==1, a*b, m==2, b/a]}]; Join[{1, 1, 2}, NestList[nxt, {1, 1, 2}, 30][[All, 2]]] (* Harvey P. Dale, Sep 04 2017 *)
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Jose Ramon Real, Oct 22 2007
EXTENSIONS
More terms from R. J. Mathar, Oct 28 2007
STATUS
approved