I am trying to solve a programming problem which I think involves n-tuples, but please tell me if I am wrong.
Given an alphabet $A$, how many words of length $l$ can be made using exactly $n$ distinct letters, where $n \le |A| \le l$?
So if, $A=\{a, b, c\},l = 3, n = 2$,
Then the possible words would be: $\{aab, aba, baa, aac, aca, caa, bba, bab, abb, bbc, bcb, cbb, cca, cac, acc, ccb, cbc, bcc\}$ (I think thats all of them)
I am familiar with the multinomial theorem, and I think I can brute force this by solving for every denominator. But this is kind of cumbersome, I was wondering if there is a simpler approach.
#python example of Riley's solution
def F(l, n, A):
if (l < n):
return 0
elif (n == 1):
return A
else:
return A * (F(l - 1, n, A, D) + F(l - 1, n - 1, A - 1, D) - F(l - 1, n, A - 1, D))