login
Alternately add and multiply.
10

%I #20 Apr 07 2021 02:49:57

%S 0,1,1,1,2,2,4,8,12,96,108,10368,10476,108615168,108625644,

%T 11798392572168192,11798392680793836,

%U 139202068568601556987554268864512,139202068568601568785946949658348,19377215893777651167043206536157390321290709180447278572301746176

%N Alternately add and multiply.

%H Reinhard Zumkeller, <a href="/A039941/b039941.txt">Table of n, a(n) for n = 0..27</a>

%H A. V. Aho and N. J. A. Sloane, <a href="https://www.fq.math.ca/Scanned/11-4/aho-a.pdf">Some doubly exponential sequences</a>, Fibonacci Quarterly, Vol. 11, No. 4 (1973), pp. 429-437, <a href="http://neilsloane.com/doc/doubly.html">alternative link</a>.

%F a(2n) = a(2n-1) + a(2n-2); a(2n+1) = a(2n-1)*a(2n); a(0) = 0; a(1) = 1

%F a(n) = {a(n-1) + a(n-2), n even, a(n-1)*a(n-2), n odd}; a(0)=0; a(1)=1.

%t nxt[{n_,a_,b_}]:={n+1,b,If[EvenQ[n],a+b,a*b]}; Join[{0},Transpose[ NestList[ nxt,{0,0,1},20]][[3]]] (* _Harvey P. Dale_, Aug 23 2013 *)

%o (PARI) a(n)=if(n<2,n>0, if(n%2,a(n-1)*a(n-2),a(n-1)+a(n-2)))

%o (Haskell)

%o a039941 n = a039941_list !! (n-1)

%o a039941_list = 0 : 1 : zipWith3 ($)

%o (cycle [(+),(*)]) a039941_list (tail a039941_list)

%o -- _Reinhard Zumkeller_, May 07 2012

%Y A001696(n)=A039941(2*n), A001697(n)=A039941(2*n+1).

%Y Cf. A077753

%K easy,nonn,nice

%O 0,5

%A _Walter Carlini_

%E Additional comments from _Michael Somos_, May 19 2000

%E One more term from _Harvey P. Dale_, Aug 23 2013