OFFSET
1,3
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..100
MATHEMATICA
a[0]=1; a[n_]:=a[n]=If[EvenQ[n], a[n-1]+n, a[n-1]n]; Join[{1}, Array[a, 40]] (* Harvey P. Dale, Apr 24 2011 *)
nxt[{n_, a_}]:={n+1, If[EvenQ[n], a+n, a*n]}; NestList[nxt, {1, 1}, 30][[All, 2]] (* Harvey P. Dale, Jul 27 2021 *)
PROG
(Haskell)
a047905 n = a047905_list !! (n-1)
a047905_list = 1 : zipWith uncurry
(cycle [(*), (+)]) (zip a047905_list [1..])
-- Reinhard Zumkeller, Nov 13 2013, May 31 2011
(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
CROSSREFS
KEYWORD
nonn,easy,nice
AUTHOR
Miklos SZABO (mike(AT)ludens.elte.hu)
STATUS
approved