login
Add 1, multiply by 1, add 2, multiply by 2, etc., start with 1.
9

%I #44 Jan 20 2024 07:06:31

%S 1,2,2,4,8,11,33,37,148,153,765,771,4626,4633,32431,32439,259512,

%T 259521,2335689,2335699,23356990,23357001,256927011,256927023,

%U 3083124276,3083124289,40080615757,40080615771,561128620794,561128620809,8416929312135,8416929312151,134670868994416

%N Add 1, multiply by 1, add 2, multiply by 2, etc., start with 1.

%H Alois P. Heinz, <a href="/A019463/b019463.txt">Table of n, a(n) for n = 0..900</a>

%H Nick Hobson, <a href="/A019463/a019463.py.txt">Python program for this sequence</a>.

%F Limit_{n->oo} a(2n)/n! = 1 + 2e = 1 + A019762. - _Jon E. Schoenfield_, Jan 16 2024

%p a:= proc(n) option remember; `if`(n=0, 1, (t->

%p `if`(n::odd, t+(n+1)/2, t*n/2))(a(n-1)))

%p end:

%p seq(a(n), n=0..32); # _Alois P. Heinz_, Jan 16 2024

%t For[i=1;lst={1},i<15,i++,AppendTo[lst,i+Last[lst]];AppendTo[lst,i Last[lst]]];lst (* _Harvey P. Dale_, Feb 25 2012 *)

%t FoldList[If[OddQ[#2], #1 + (#2 + 1)/2, #1 * (#2/2)]&, 1, Range[32]] (* _AnneMarie Torresen_, Nov 26 2023 *)

%o (PARI) A019463(n, a=1)={for(i=2, n+1, if(bittest(i, 0), a*=i\2, a+=i\2)); a} \\ _M. F. Hasler_, Feb 25 2018

%Y Cf. A019461 (same, but start with 0), A019460 (start with 2), A019462, (start with 3), A082448. (start with 4).

%Y Cf. A082458, A019464, A019465, A019466 (similar, but first multiply, then add).

%Y Cf. A019762.

%K nonn

%O 0,2

%A _N. J. A. Sloane_

%E Edited by _M. F. Hasler_, Feb 25 2018