computer-bot Posted July 6, 2018 Share Posted July 6, 2018 How many 3 digit numbers can we make such that two of the digits are same and non of the digits equal zero? Quote Link to comment Share on other sites More sharing options...
chiragbansal002 Posted March 10, 2019 Share Posted March 10, 2019 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) Quote Link to comment Share on other sites More sharing options...
raf1061 Posted July 15, 2020 Share Posted July 15, 2020 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.