Jump to content
Urch Forums

3 digit number


computer-bot

Recommended Posts

  • 8 months later...

0 _ _

 

For a three digit number, hundreds digit can have only 9 possible values (1-9) because if hundreds digit is zero then the number is not a 3 digit number.

 

Case I. Hundreds digit and units digit are same

9 possible values for hundreds digit, the same number has to be at units place. Except the number at hundreds place and zero, tens digit can have 8 possible values. Possible number of permutations = 9*8*1 = 72

 

Case II. Hundreds digit and tens digit are same

9 possible values for hundreds digit, the same number has to be at tens place. Except the number at hundreds place and zero, units digit can have 8 possible values. Possible number of permutations = 9*1*8 = 72

 

Case III. Units digit and Tens digit are same

9 possible values for hundreds digit. Since the number at tens (or units) place is different than the number at hundreds digit (otherwise all three numbers will be equal) and since we can't include zero, tens (or units) place will also have 8 possible values for this case. Possible number of permutations will be = 9*8*1 = 72

 

Adding all the possible permutations we'll get 216 possible numbers.

 

 

------ --------- ----------- ---------- --------- -------

 

I also write the following python code for this problem - it returns 216 elements.

 

 

result_numbers = []

counter_=0

for n in range(100, 1000):

ns = list(str(n))

if '0' not in ns:

if ns[0]==ns[1] or ns[1]==ns[2] or ns[0]==ns[2]:

if ns[0]==ns[1] and ns[1]==ns[2]:

counter_ +=0

else:

counter_ +=1

result_numbers.append(n)

print ("counter={}".format(counter_))

print (result_numbers)

Link to comment
Share on other sites

  • 1 year later...

There are 9 digits to be considered. Because 0 shouldn't be of any concern.

Now lets see, how many total permutation is possible (including repeatation). This is, 9*9*9=729

How many permutation possible if all the numbers are same? It is 9

How many permutation are possible all the numbers are different? It is 9*8*7=504

 

So our answer here is 729-9-504= 216

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...