login
Boustrophedon transform of n mod 2.
6

%I #35 Jun 12 2022 12:01:50

%S 0,1,2,4,12,36,142,624,3192,18256,116282,814144,6219972,51475776,

%T 458790022,4381112064,44625674352,482962852096,5534347077362,

%U 66942218896384,852334810990332,11394877025289216

%N Boustrophedon transform of n mod 2.

%H Reinhard Zumkeller, <a href="/A062161/b062161.txt">Table of n, a(n) for n = 0..400</a>

%H Peter Luschny, <a href="http://oeis.org/wiki/User:Peter_Luschny/SeidelTransform">An old operation on sequences: the Seidel transform</a>

%H J. Millar, N. J. A. Sloane and N. E. Young, A new operation on sequences: the Boustrophedon transform, J. Combin. Theory, 17A 44-54 1996 (<a href="http://neilsloane.com/doc/bous.txt">Abstract</a>, <a href="http://neilsloane.com/doc/bous.pdf">pdf</a>, <a href="http://neilsloane.com/doc/bous.ps">ps</a>).

%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Boustrophedon_transform">Boustrophedon transform</a>

%H <a href="/index/Bo#boustrophedon">Index entries for sequences related to boustrophedon transform</a>

%F a(2n) = A009747(n), a(2n+1) = A002084(n).

%F E.g.f.: (sec(x)+tan(x))sinh(x); a(n)=(A000667(n)-A062162(n))/2. - _Paul Barry_, Jan 21 2005

%F a(n) = Sum{k, k>=0} binomial(n, 2k+1)*A000111(n-2k-1). - _Philippe Deléham_, Aug 28 2005

%F a(n) = sum(A109449(n,k) * (n mod 2). - _Reinhard Zumkeller_, Nov 03 2013

%t With[{nn=30},CoefficientList[Series[(Sec[x]+Tan[x])Sinh[x],{x,0,nn}],x] Range[ 0,nn]!] (* _Harvey P. Dale_, Feb 16 2013 *)

%o (Sage) # Generalized algorithm of L. Seidel (1877)

%o def A062161_list(n) :

%o R = []; A = {-1:0, 0:0}

%o k = 0; e = 1

%o for i in range(n) :

%o Am = 1 if e == -1 else 0

%o A[k + e] = 0

%o e = -e

%o for j in (0..i) :

%o Am += A[k]

%o A[k] = Am

%o k += e

%o # print [A[z] for z in (-i//2..i//2)]

%o R.append(A[e*i//2])

%o return R

%o A062161_list(10) # _Peter Luschny_, Jun 02 2012

%o (Haskell)

%o a062161 n = sum $ zipWith (*) (a109449_row n) $ cycle [0,1]

%o -- _Reinhard Zumkeller_, Nov 03 2013

%o (Python)

%o from itertools import accumulate, islice

%o def A062161_gen(): # generator of terms

%o blist, m = tuple(), 1

%o while True:

%o yield (blist := tuple(accumulate(reversed(blist),initial=(m := 1-m))))[-1]

%o A062161_list = list(islice(A062161_gen(),40)) # _Chai Wah Wu_, Jun 12 2022

%Y Cf. A000035, A062272.

%K nonn,easy

%O 0,3

%A _Frank Ellermann_, Jun 10 2001