Suppose we have $A = \{a_1,a_2,\ldots,a_5\}, B = \{b_1,b_2,\dots,b_4\}$ Problem: Count the number $k$ of onto functions $g_j$ (over the integers thru $k$) such that $g_j(a_1) \neq g_j(a_2)$ for all $j$.
The way I'm thinking about this is in terms of alphabets $abcde$. For the first two slots, we choose 2 elements out of the 4, and permute those. Then for the other three slots, we choose 3 elements out of the 4 and then permute them. So in total we have:
$ \begin{pmatrix} 4\\ 2 \end{pmatrix}2! + \begin{pmatrix} 4\\ 3 \end{pmatrix}3! = 36 $
Is this correct?
EDIT: Thank you all. I've learnt from all of your answers, and it's amazing that I got to see three different ways of counting the same number. I tried to re-reason my approach to supply the missing factor (3!) but I couldn't get anywhere sensible. If you can see a cool way to reinterpret it I would be happy to hear about it too!