Re: Combinatoric question
- From: Larry Coon <lmcoon_nospam@xxxxxxx>
- Date: Sat, 13 May 2006 11:01:32 -0700
Robert Israel wrote:
The number of n-digit numbers (with leading zeros allowed)
having the digit d exactly x times may be obtained as
follows. Think of how you might select such a number.
1) choose x places out of n to put the digit d
2) fill the other n-x places with the other 9 digits.
So the number of ways to do this is (n choose x) 9^(n-x).
The number of n-digit numbers (with leading zeros allowed)
having the digit d at least x times is thus
sum_{y=x}^n (n choose y) 9^(n-y)
This can be written using a hypergeometric function, but
it's easier to just do the sum.
As was mentioned, if you don't allow leading zeros (and d
is not 0), just subtract the value for n-1 from the value
for n.
Thanks! (And thanks to the others who answered). Makes
perfect sense now that I've had a chance to read someone
else's explanation.
And to clarify, I was interested in ten-digit strings of
digits, and not really numbers less than 10 billion (so
leading zeros are included).
.
- References:
- Combinatoric question
- From: Larry Coon
- Re: Combinatoric question
- From: Robert Israel
- Combinatoric question
- Prev by Date: Give
- Next by Date: Re: problem
- Previous by thread: Re: Combinatoric question
- Next by thread: Generating uniform probability vector
- Index(es):
Relevant Pages
|