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.
%I A153335 #18 May 22 2025 10:21:35 %S A153335 0,1,2,8,18,52,116,296,650,1556,3372,7768,16660,37416,79592,175568, %T A153335 371034,807604,1697660,3657464,7654460,16357496,34106712,72407728, %U A153335 150499908,317777032,658707896,1384524656,2863150440,5994736336 %N A153335 Number of zig-zag paths from top to bottom of an n X n square whose color is not that of the top right corner. %H A153335 Indranil Ghosh, <a href="/A153335/b153335.txt">Table of n, a(n) for n = 1..1000</a> %H A153335 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 A153335 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)binomial(n-1,(n-1)/2) for n odd. %t A153335 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) Binomial[n-1,(n-1)/2]],{n,1,30}] (* _Indranil Ghosh_, Feb 19 2017 *) %o A153335 (Python) %o A153335 import math %o A153335 def C(n, r): %o A153335 f=math.factorial %o A153335 return f(n)/f(r)/f(n-r) %o A153335 def A153335(n): %o A153335 if n%2==0: return str(int((n+1)*2**(n-2)-2*(n-1)*C(n-2, (n-2)/2))) %o A153335 else: return str(int((n+1)*2**(n-2)-(n)*C(n-1, (n-1)/2))) # _Indranil Ghosh_, Feb 19 2017 %o A153335 (PARI) a(n) = if (n % 2, (n+1)*2^(n-2) - n*binomial(n-1,(n-1)/2), (n+1)*2^(n-2) - 2*(n-1)*binomial(n-2,(n-2)/2)); \\ _Michel Marcus_, Feb 19 2017 %Y A153335 Cf. A102699, A153334, A153336, A153337, A153338. %K A153335 easy,nonn %O A153335 1,3 %A A153335 _Joseph Myers_, Dec 24 2008