Password Q: How many combinations of a,b,c,d,c,1,2,3,4,5, w/ repetitions, have <= 4 digits?

Drazil

New member
Joined
Oct 17, 2018
Messages
2
Suppose we want to make a 10 character password with the following set: {a, b, c, d, e, 1, 2, 3, 4 , 5}
Characters ARE repeatable (meaning the number of total combinations should be 10^10)

- How many combinations have 4 or less digits?

I do know how to solve this by adding up the possibilities of having 0, 1, 2, 3, and 4 digits.
(5^10 + 5*(10c1)*5^9 + 5^2*(10c2)*5^8 + 5^3*(10c3)*5^7 + 5^4*(10c4)*5^6)

I'm posting this question to ask if there is a more elegant answer.
What if the password was 100 digits long, my method would be impractical...
 
How many combinations have 4 or less digits?
Can the digits still repeat?
 
Last edited:
If c is the characters in the password and d is the maximum number of digits allowed, the number you are looking for is

[math] \sum_{i=0}^d 5^{(c-i)} * \dbinom{c}{i} * 5^i = 5^c * \sum_{i=0}^d \dbinom{c}{i}.[/math]
According to Wikipedia, there is no exact formula for that sum, but if d is small, it is easily calculable by hand even for large values of c. Moreover, if we are talking about realistic passwords, c would seldom if ever be longer than 20 characters. An excell spreadsheet can easily be constructed to give the sums associated with each value of c from 5 to 20 and each value of d up to c.

Moreover, for really large values of c and d, I suspect approximation methods are available.

By the way, I was surprised that the partial sums of the binomial coefficients associated with c do not have a simple formula because the sum of all the binomial coefficients associated with c is given by a very simple formula.
 
Top