OFFSET
1,2
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
MAPLE
A252729 := proc(n)
option remember;
if n =1 then
1;
elif modp(n, 3) = 2 then
procname(n-1)+n-1;
elif modp(n, 3) = 0 then
procname(n-1)-(n-1);
elif modp(n, 3) = 1 then
procname(n-1)*(n-1);
fi ;
end proc:
seq(A252729(n), n=1..32) ; # R. J. Mathar, Mar 20 2015
MATHEMATICA
nxt[{n_, a_}]:={n+1, Which[Mod[n+1, 3]==1, a+n+1, Mod[n+1, 3]==2, a-(n+1), True, a*(n+1)]}; Transpose[NestList[nxt, {0, 1}, 35]][[2]] (* Harvey P. Dale, Mar 29 2015 *)
PROG
(Liberty BASIC)
input "How many terms? "; nt:a=1
1 print a; ", "; :n=n+1:a=a+n
print a; ", "; :n=n+1:a=a-n
print a; ", "; :n=n+1:a=a*n
if n<nt then goto 1 else end
CROSSREFS
KEYWORD
sign,easy
AUTHOR
Edwin McCravy, Dec 20 2014
STATUS
approved