Question: Last weekend, I added two three-digit numbers and , where the six digits I used to write and were all different. was another three-digit number. I added the digits in and to obtain another number . What can you say about ?
Below, I will give a solution to the original question as well as expanding the problem to other possible variations.
The function returns the digits of the numbers inputed as elements of an array. For example,
The following cell loops through every possible pair of two three-digit integers. If the digits in the two numbers are all different and the two numbers sum to a three digit number, the sum of their digits is added to an array, . After all pairs have been checked, it displays .
So, we know that must have been one of the integers listed above. We can go a step further and find the number of possible pairs that sum to a given entry in by slightly altering the code above. Scince the largest number the digits of and could possibly sum to is , we will make another array of length that counts the number of times each index of is summed to (the indeces start at 0).
We can graph the frequency of summing to versus .
From this, we can see that if you were to want to guess what was, the best guess is .
We might now consider the following more abstract question:
Question: For , -digit numbers and , where the digits I used to write and were all different, if was another -digit number, what are the possible values of the sum of the digits in and and what is the most probable sum?
We can easily rewrite the code cell above as a function of and .
Clearly, we must have that the number of digits, . Since and are integers, we can calculate for all possible inputs! The cell below will calculate for some of the other possible inputs and display (the array of all possible digit sums), and the frequency bar plot that was discussed earlier. It will also display the 'best guess' for , which is the index of where maximum of occurs. (If the maximum of is in more than one index, the code below will display only the first index).