[go: up one dir, main page]

login
A252729
Start with 1, add 1, subtract 2, multiply by 3, add 4, subtract 5, multiply by 6, add 7, etc.
1
1, 2, 0, 0, 4, -1, -6, 1, -7, -63, -53, -64, -768, -755, -769, -11535, -11519, -11536, -207648, -207629, -207649, -4360629, -4360607, -4360630, -104655120, -104655095, -104655121, -2825688267, -2825688239, -2825688268, -84770648040, -84770648009
OFFSET
1,2
LINKS
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
Sequence in context: A106235 A288098 A118965 * A121552 A350785 A158118
KEYWORD
sign,easy
AUTHOR
Edwin McCravy, Dec 20 2014
STATUS
approved