login
A047907
a(n+1) = a(n) - n (if n is even), a(n+1) = a(n) * n (if n is odd).
3
1, 1, -1, -3, -7, -35, -41, -287, -295, -2655, -2665, -29315, -29327, -381251, -381265, -5718975, -5718991, -97222847, -97222865, -1847234435, -1847234455, -38791923555, -38791923577, -892214242271, -892214242295, -22305356057375, -22305356057401
OFFSET
1,4
LINKS
MAPLE
a:= proc(n) option remember; `if`(n=1, 1,
`if`(irem(n, 2)=1, a(n-1) -(n-1), a(n-1) *(n-1)))
end:
seq(a(n), n=1..30); # Alois P. Heinz, Jun 24 2013
MATHEMATICA
nxt[{n_, a_}]:={n+1, If[OddQ[n], a-(n+1), a(n+1)]}; Transpose[NestList[nxt, {0, 1}, 30]][[2]] (* Harvey P. Dale, Jun 24 2013 *)
PROG
(Haskell)
a047907 n = a047907_list !! (n-1)
a047907_list = 1 : zipWith uncurry
(cycle [(*), (-)]) (zip a047907_list [1..])
-- Reinhard Zumkeller, Nov 13 2013, Dec 17 2011
CROSSREFS
KEYWORD
sign,nice,easy
AUTHOR
Miklos SZABO (mike(AT)ludens.elte.hu)
STATUS
approved