Well... I am stuck with the recurrence problem...
Find a recurrence relation for the number Queen walks from the lower-left corner of an arbitrary-size chess board to the square $(n,n)$. (A Queen can move any number of squares horizantally, vertically, or diagonally. Assume that the Queen always move to the right,up, or up-right.) Find the corresponding generating function.
I think I have to split the cases with the movements(right, up, or up-right.)
It becomes tricky with that a Queen can move any number of squares...
Can I get some clue to start?
See, that from position $(a,b)$ the queen can move right in $n-b$ ways, up in $n-a$ ways and 'right-up' in $\min(n-a, n-b)$ ways.
Therefore the recursive function can be written as
or, in mathematical way:
$f(a,b,n) = \begin{cases}1 &, (a,b)=(n,n);\\ \sum\limits_{i=a+1}^nf(i,b,n)+\sum\limits_{i=b+1}^n f(a,i,n) + \sum\limits_{i=1}^{\min(n-a,n-b)}f(a+i,b+i,n) &, (a,b)\neq (n,n); \end{cases}$