I have been considering the following problem: say you are picking from an infinite population of red and blue balls. A ball has a probability $p$ of being red; otherwise it is blue. If I choose $n$ balls at random, what is the probability that exactly $k$ of them are red? Denote this probability as $a(n, k, p)$. Thinking about this, one can see that $$a(n, k, p) = p\cdot a(n-1, k-1, p) + (1-p)\cdot a(n-1, k, p)$$ $$a(k, k, p) = p^k$$ $$a(0, n, p) = (1-p)^n$$ (if I'm not mistaken, the above three facts should be enough to uniquely define this function)
If possible, I would like to find an explicit formula for this function. I have tried making a generating function, I've tried finding formulas for special cases (I found some such formulas, but they didn't help me get a general formula).
I apologize if this is a duplicate, I couldn't find anything on this problem.