# Probability of 2 uniformly randomly generated, n-digit numbers (n>=4) having the same last 4 digits?

I apologize if question is too simple!

For example, is the probability of generating 2, 8-digit numbers that have the last 4 digits match the same as the probability of the last 4 matching with a 12 digit number?

For an 8 digit number:

10^8 total possible numbers and 10*10*10*10*1*1*1*1 = 10^4 / 10^8 = 1/10,000 probability of generating 2 with the same last 4.

For 12 digit:

10^12 total possible. 10^8 / 10^12 = 1/10,000 probability again of generating 2 with the same last 4?

Is this correct?

• How are these values generated? Do they come from a uniform distribution? Mar 18, 2013 at 22:21
• Sorry, yes uniform distribution. I will add that to the question! Mar 18, 2013 at 22:27

Here's another way to look at it that might require less arithmetic. Reframe the question: each digit is sampled independently and identically uniformly on $0, 1, \dots, 9$. Then having the last 4 digits match for two 8 digit numbers is the same as the probability of having two 4 digit numbers match exactly (the other digits don't matter since they are independent of the last 4, and we're not interested in whether they match or not). The probability the last 4 digits match is $(1/10)^4$ which is what you wrote above. Taking this same perspective for the 12 digit numbers, it doesn't matter what the first 8 digits are, and you again have $(1/10)^4$ chance of getting matching last 4 digits.