Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I have to get all combinations of a six digit number where each digit is unique. Its clear that this combination will not have a 0 at the start as it will not be a valid six digit number. Help me on how to attack this problem.

share|improve this question
2  
Are you assuming that the first digit can't be 0 or is it explicitly stated? Because in something like a PIN, 0 is a valid leading digit. –  Thomas Owens Aug 31 '10 at 12:01
    
just count all combinations where each digit is unique, and subtract all combinations starting with 0 and having unique digits in (1,2,...9) :-) –  mau Aug 31 '10 at 12:17

2 Answers 2

up vote 3 down vote accepted

First, if you're talking about a six-digit number, the order of the digits matters, so it's generally not referred to as a combination.

Consider how many possibilities there are for the first digit. As you said, it cannot be zero, or you wouldn't have a six-digit number. Once there is a first digit, how many possibilities are there for the second digit? Then for the third? And so on.

The total number of six-digit numbers is the product of the various numbers of possibilities for each digit.

(As the question feels like homework to me, this is more of a hint/outline than a complete answer. If it actually is homework, please add the homework tag. If it's not homework, or if this doesn't get you to an answer, please comment with more information.)

share|improve this answer
1  
Its not a homework in the literal sense, but I am trying to learn, so tagged it as homework anyways. Thanks for you hints. If possible, can you provide some links where I can learn Perm&Comb from scratch –  bragboy Aug 31 '10 at 13:01

This seems simple : The digits will be from the set {0,1,2,3,4,5,6,7,8,9}

Number of possibility for first digit (Most significant digit) = 9 (since we can't use 0) Number of possibility for second digit = 9 Number of possibility for third digit = 8 ... Number of possibility for sixth digit (Least significant digit) = 5

Hence total possibility = 9*9*8*7*6*5.

share|improve this answer
    
this is absolutely right answer –  iostream007 May 10 '13 at 6:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.