login
A047904
a(n+1) = a(n) + n (if n is odd), a(n+1) = a(n) * n (if n is even).
8
1, 2, 4, 7, 28, 33, 198, 205, 1640, 1649, 16490, 16501, 198012, 198025, 2772350, 2772365, 44357840, 44357857, 798441426, 798441445, 15968828900, 15968828921, 351314236262, 351314236285, 8431541670840, 8431541670865, 219220083442490
OFFSET
1,2
MATHEMATICA
Transpose[NestList[{#[[1]]+1, If[OddQ[#[[1]]], Total[#], Times@@#]}&, {1, 1}, 30]][[2]] (* Harvey P. Dale, Sep 11 2012 *)
PROG
(Python)
a=1
for n in range(1, 33):
print(a, end=", ")
if n&1:
a += n
else:
a *= n
# Alex Ratushnyak, Feb 24 2013
(Haskell)
a047904 n = a047904_list !! (n-1)
a047904_list = 1 : zipWith uncurry
(cycle [(+), (*)]) (zip a047904_list [1..])
-- Reinhard Zumkeller, Nov 13 2013, Mar 24 2013
CROSSREFS
KEYWORD
nonn,easy,nice
AUTHOR
Miklos SZABO (mike(AT)ludens.elte.hu)
STATUS
approved