What are the different combinations of three digit numbers?
I have a formula.All 120 unique numbers were generated.I don't understand one simple thing.I will receive 720 unique combinations if I remove +2 from both inner loops variable initialization.I am getting 120 with this +2.There are no numbers like 517 and 715 because it clears out numbers.Is it possible that adding +2 to inner loops only leaves one arrangement?There must be at least 6 unique sets of 120 numbers.
All of the sets of three unique digits are found by the algorithm because they begin with 0 1, 2, and 7.
Limits placed on i, j, and k play a part in this.The last set will have a maximum value of 7 and a minimum of 8.When the i-loop is first stopped.
There are no more unique sets that start with 0, and we already have 0 1 9, so we have all of them.The first one is:
I don't think it's a good idea to think of what is happening here as "getting rid of duplicate" or something similar.This is about how to count.The number of unique sets of three digits is what we want to count.Since the sets contain the same members, we don't want to list all of them, but just one.1 1 2 is not a set in this context.We can either choose a convenient criterion for choosing which sets we will count, or we can choose to count the ordered sets in ascending order.We simply count them.
The combinations are listed as if they were three-digit numbers, from smallest to largest.The smallest possibility is 0 1 2.The smallest "number" that begins with the digit d is d, and the largest is 8 9.7 8 9 is the largest number.The limits for our loop conditions are provided by these observations.
The triple of digits are a counter.We can list all the numbers in descending order.We decided to count the "numbers" with digits in ascending order.We could have chosen to count the numbers in descending order.
It might be a good idea for you to modify your algorithm to display the digits in descending order.This could help solidify your understanding.
The numbers have digits in ascending order.You start with 012 and increment the last digit until 019.The next digit will not be the same because the +2 increases it by one.If you don't use it, you would start at 000 and count up to 789.
All of your digits are in order.The last is always larger than the other two.If you start with 012 and increase it, you will get all the numbers with a single digit in them.If you have all possibilities with 0, you can go to 123.
There are more than one duplicate in 720 numbers.The set of numbers are considered to be duplicate.
We are generating 8 numbers in the first line.We are getting one number less with each loop cycle.