Skip to content

Instantly share code, notes, and snippets.

Created July 17, 2016 16:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/c3787046b7e073a65f4756361891a537 to your computer and use it in GitHub Desktop.
Save anonymous/c3787046b7e073a65f4756361891a537 to your computer and use it in GitHub Desktop.
Expected # left turns in lattice path (0,0) to (a,b)
left[a_, b_] :=
Sum[(
Sum[Binomial[k - 1, i],
{i, Max[0, k - b], Min[a - 1, k - 1]}
] + Binomial[k - 1, a - 1]
) 2^(a + b - 1 - k),
{k, a + b - 1}
]/2^(a + b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment