cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A153334 Number of zig-zag paths from top to bottom of an n X n square whose color is that of the top right corner.

This page as a plain text file.
%I A153334 #11 May 22 2025 10:21:35
%S A153334 1,1,4,8,24,52,136,296,720,1556,3624,7768,17584,37416,83024,175568,
%T A153334 383904,807604,1746280,3657464,7839216,16357496,34812144,72407728,
%U A153334 153204064,317777032,669108496,1384524656,2903267040,5994736336
%N A153334 Number of zig-zag paths from top to bottom of an n X n square whose color is that of the top right corner.
%H A153334 Indranil Ghosh, <a href="/A153334/b153334.txt">Table of n, a(n) for n = 1..1000</a>
%H A153334 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 A153334 a(n) = (n+1)2^(n-2) - 2(n-1)binomial(n-2,(n-2)/2) for n even, a(n) = (n+1)2^(n-2) - (n-1)binomial(n-1,(n-1)/2) for n odd.
%t A153334 Table[If[Mod[n,2]==0, (n+1)*2^(n-2)-2(n-1) Binomial[n-2,(n-2)/2], (n+1)*2^(n-2)-(n-1)  Binomial[n-1,(n-1)/2]],{n,1,30}] (* _Indranil Ghosh_, Feb 19 2017 *)
%o A153334 (Python)
%o A153334 import math
%o A153334 def C(n,r):
%o A153334     f=math.factorial
%o A153334     return f(n)/f(r)/f(n-r)
%o A153334 def A153334(n):
%o A153334     if n%2==0: return str(int((n+1)*2**(n-2)-2*(n-1)*C(n-2,(n-2)/2)))
%o A153334     else: return str(int((n+1)*2**(n-2)-(n-1)*C(n-1,(n-1)/2))) # _Indranil Ghosh_, Feb 19 2017
%Y A153334 Cf. A102699, A153335, A153336, A153337, A153338.
%K A153334 easy,nonn
%O A153334 1,3
%A A153334 _Joseph Myers_, Dec 24 2008