Combinatoric question



Not homework or anything like that -- just curiosity.
Been too long since college math classes, and I didn't
turn up anything via Google.

What's the correct approach to problems like, "find
how many n-digit numbers have the digit d at least x
times." E.g., "find how many 10-digit numbers have
at least five sevens."

Easy enough to write a program to iterate through the
numbers and count them, but that's cheating. (I
cheated anyway and got 16,349,374.)

I tried approaching it as 10,000,000,000 minus the
number of permutations of 10 items taken six at a time
where none of the digits is seven (i.e., eliminate the
permutations where at least six digits are not seven),
but that wasn't getting me anywhere.
.



Relevant Pages

  • Re: Combinatoric question
    ... turn up anything via Google. ... at least five sevens." ... number of permutations of 10 items taken six at a time ... where none of the digits is seven (i.e., ...
    (sci.math)
  • [SUMMARY] Getting to 100 (#119)
    ... puts "#possible equations tested" ... they can come up in and Dennis chose to just hardcode those in the OPS constant. ... Dennis just counts off some number of digits from the front of the ... works by recursively combining smaller and smaller permutations until it has ...
    (comp.lang.ruby)
  • Solving the Google "prime number in e" challenge
    ... JOB HUNTERS, GOOGLE THIS ... Here you'll find a RosAsm assembly program that computes the decimal digits ... have one multi-kilobyte number to deal with, E, that you divide by N, ... the Woz algorithm runs through a long memory array one byte ...
    (alt.lang.asm)
  • Re: Recursive function to develop permutations
    ... the recursion in, then removing it by explicitly introducing a stack; ... definition of "permutations of length N out of a list of X values". ... This is like saying that (if the X values are digits in base X) the ... So, we have reduced the problem to one of counting in an arbitrary base, ...
    (comp.lang.python)
  • Re: some OT: how to solve this kind of problem in our program?
    ... fewer than 3.3 million possible permutations of 9 rows of the digits 1-9, ... few match the additional constraints. ...
    (comp.lang.python)