OFFSET
1,3
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
EXAMPLE
a(3)=abs(1-3*1)=2, a(4)=abs(2-3*1)=1, a(5)=abs(1-3*2)=5, a(6)=abs(5-3*1)=2, a(7)=abs(2-3*5)=13.
MAPLE
A192263 := proc(n) option remember; if n <=2 then 1; else abs(procname(n-1)-3*procname(n-2)) ; end if; end proc: # R. J. Mathar, Jul 12 2011
MATHEMATICA
nxt[{a_, b_}]:={b, Abs[b-3a]}; NestList[nxt, {1, 1}, 40][[All, 1]] (* Harvey P. Dale, Dec 16 2021 *)
PROG
(MATLAB) % n = number of computed terms of sequence. Beware of 64bit restrictions of MATLAB integers and floating point numbers
a(1)=1 ; a(2)=1 ;
for i=3:n,
a(i) = abs(a(i-1)-3*a(i-2)) ;
end
(PARI) N=66; v=vector(N); /* that many terms */
v[1]=1; v[2]=1; for(n=3, N, v[n]=abs(abs(v[n-1] - 3*v[n-2])));
v /* show terms */ /* Joerg Arndt, Jul 02 2011 */
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Pasi Airikka, Jun 27 2011
STATUS
approved