1. ## 3 digit number

How many 3 digit numbers can we make such that two of the digits are same and non of the digits equal zero?  Reply With Quote

2. ## Re: 3 digit number

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==ns or ns==ns or ns==ns:
if ns==ns and ns==ns:
counter_ +=0
else:
counter_ +=1
result_numbers.append(n)
print ("counter={}".format(counter_))
print (result_numbers)  Reply With Quote

There are currently 1 users browsing this thread. (0 members and 1 guests)

digit, digits, equal, number, numbers 