login
Number of zig-zag paths from top to bottom of a 2n by 2n square whose color is that of the top right corner
5

%I #8 Feb 20 2017 00:28:02

%S 1,8,52,296,1556,7768,37416,175568,807604,3657464,16357496,72407728,

%T 317777032,1384524656,5994736336,25816193952,110652549620,

%U 472302724408,2008499580504,8513063608304,35975584631128,151621915797840

%N Number of zig-zag paths from top to bottom of a 2n by 2n square whose color is that of the top right corner

%H Indranil Ghosh, <a href="/A153336/b153336.txt">Table of n, a(n) for n = 1..1000</a>

%H Joseph Myers, <a href="http://www.polyomino.org.uk/publications/2008/bmo1-2009-q1.pdf">BMO 2008--2009 Round 1 Problem 1---Generalisation</a>

%F a(n) = (2n+1)2^(2n-2) - 2(2n-1)binomial(2n-2,n-1).

%e a(3) = (2*3 + 1)*2 ^ (2*3 - 2) - 2*(2*3 - 1) * binomial(2*3 - 2, 3 - 1) = 52. - _Indranil Ghosh_, Feb 19 2017

%t Table[(2n+1) 2^(2n-2)-2(2n-1) Binomial[2n-2,n-1],{n,1,22}] (* _Indranil Ghosh_, Feb 19 2017 *)

%o (Python)

%o import math

%o def C(n,r):

%o ....f=math.factorial

%o ....return f(n)/f(r)/f(n-r)

%o def A153336(n):

%o ....return str((2*n+1)*2**(2*n-2)-2*(2*n-1)*C(2*n-2,n-1)) # _Indranil Ghosh_, Feb 19 2017

%o (PARI) a(n) = (2*n+1)*2^(2*n-2) - 2*(2*n-1)*binomial(2*n-2, n-1); \\ _Michel Marcus_, Feb 19 2017

%Y Cf. A102699, A153334, A153335, A153337, A153338.

%K easy,nonn

%O 1,2

%A _Joseph Myers_, Dec 24 2008, Dec 31 2008