List the sum of all numbers between 7,777 and 70,000, where the numbers are divisible by 7.

## Identification of the problem

The crux of this problem is to break the larger numbers down into smaller sets, or groups, so that we can try and identify some type of pattern to work with. To solve this problem, we will need to calculate the sum of all the numbers between 7,777 and 70,000, but only for those numbers that are divisible by seven.

## Analysis

We will need some type of a chart to help us understand the numbers we are working with. It would be unrealistic for us to list all the numbers between 7,777 and 70,000, so we will work with a smaller list.

7,777 + 7,784 + 7,791 + … + 69,986 + 69,993 + 70,000

The numbers we will be working with are listed above. I have used an ellipse, to signify that there are missing numbers. This is much more practical than trying to list all the numbers. The list shows that the numbers start at 7,777 and continue counting by seven, until the number 70,000 has been reached.

The problem asks us for the sum of all the numbers that are divisible by seven. Using this information, we can dramatically decrease the size of our list, as I have done above, by incrementing the numbers by seven.

Basic math skills will tell us that the number 7,778 is between 7,777 and 70,000; however, we are not interested in that number, because it is not divisible by seven. By incrementing the list by seven, I have excluded all the numbers that will have no effect on the outcome of this problem.

Now, we need to find the sum of all the numbers in our list. I could add them all manually, either in my head, or by using a calculator; however, this would take an outrageous amount of time, and is not a very practical solution.

We are going to use a more logical method to find the answer to this question. So, the first thing we will need to do, is see if there is any data in the number list that we can work with. Let us try to alternate extremes on the number list and see what happens. We will take the smallest number in the list and add it to the largest number in the list.

7,777 + 70,000 = 77,777

After doing this, we can see that the answer is 77,777; but does that number have any significance? Let us find out by alternating extremes again. We will take the next number, from each side, and add them together, just to test the result.

7,784 + 69,993 = 77,777

It appears that we have gotten the same result again; both calculations resulted in the number 77,777. Let us try alternating extremes one more time and see if we get the same result.

7,791 + 69,986 = 77,777

Now that were able to produce the same answer three times in a row, it is *probably* safe to assume that this is not a coincidence. It seems that, by alternating extremes, we can produce the same number every time.

We now have a number that appears to show up every time, but what does this number mean, and does it have any significance in solving this problem? The answer is, *yes*! I will show you why…

First, look at the diagram I have drawn below. This should help you understand the calculations we have done thus far. I have drawn lines from the numbers that we have calculated and listed the sum of those numbers where the lines connect. As you can see, each result was the same.

I have taken the number 77,777 and labeled it as our “set sum”. The name itself does not mean anything, but it should help you understand the diagram, and our problem, a little better.

Let us build an algorithm to help us solve the rest of the problem. There are probably many different algorithms that would work for a problem like this. I am going to show you one method, that I know works. You can then use a program such as Microsoft Excel to verify that the answer we came up with is correct.

The first thing we are going to do is create the outside set. To do this, we are going to subtract numbers, instead of adding numbers. Because we are looking for the sum of all numbers divisible by seven, let us create the outside set using the number seven. We will take the smallest number in the list and subtract seven from it; this will be our outside set sum.

7,777 – 7 = 7,770

Per the calculation above, our outside set is 7,777 – 7, and our outside set sum is 7,770. The next thing we will do is take the largest number in our list and subtract our outside set sum. This is shown in the following calculation.

70,000 – (7,777 – 7) = 62,230

We have used two numbers to make up each set in this solution, and we were looking for all numbers that were divisible by seven. So, to find the next part of our algorithm, we will take the total number of numbers (elements), in each set, and multiply them by the number seven.

2 x 7 = 14

Now, let us take the number 62,230, and divide it by the number 14, to get the next part of our algorithm. We will then multiply that number by our set sum to find the final answer to this problem.

62,230 ÷ 14 = 4,445

4,445 x 77,777 = 345,718,765

This is our completed algorithm:

## Heuristics

- We created a list which contained all the possible numbers.
- We created a diagram to give a better idea of how things fit together.
- We labeled our set sum, and outside set, to make them easier to understand.
- We created an algorithm to solve the final problem.

## Looking Back

This is probably not the only algorithm that can be used to solve this problem, and I did not create this algorithm on the first try. It took an hour, or two, of guessing, checking, and moving things around, to get this to work.

One interesting thing you will probably notice is that every number in this problem is divisible by seven. Even the final answer is divisible by seven. If you wanted to do this problem where each number was divisible by five, you would want to rearrange a few of the numbers, so that you were using a five instead of a seven.

If you want to test that my calculations are correct, you could write a computer program that would run through the calculations for you, or, if you are not able to write your own program, you could use Microsoft Excel to validate the answer.

Using Microsoft Excel, you can enter the number 7,777, into any cell in the program, and then use the “fill series” function, ending at the number 70,000, and using a step value of 7. This will create the same list I have created above. You will have all the numbers between 7,777, and 70,000, that are divisible by seven, listed in various cells. You can then use the “Sum” function, to add up all the numbers.

The answer shown in Excel, will most likely be an exponent value, so you will need to format the cell which contains the final answer into a “General Number” cell. This will display the full decimal value of the number.