2.5 Series Summation
Here is a famous story about the legendary mathematician/physicist Gauss: When he was a child, his teacher gave the children a boring assignment to add the numbers from 1 to 100. To the amazement of the teacher, Gauss turned in his answer in less than a minute. Here is his approach:
18This approach can be generalized to any integer :
The summation formula for consecutive squares may not be as intuitive:
But if we correctly guess that and apply the initial conditions
we will have the solution that . We can then easily show that the same equation applies to all by induction.
Clock pieces
A clock (numbered 1 – 12 clockwise) fell off the wall and broke into three pieces. You find that the sums of the numbers on each piece are equal. What are the numbers on each piece? (No strange-shaped piece is allowed.)
Solution: Using the summation equation, . So the numbers on each piece must sum up to 26. Some interviewees mistakenly assume that the numbers on each piece have to be continuous because no strange-shaped piece is allowed. It’s easy to see that 5, 6, 7 and 8 add up to 26. Then the interviewees’ thinking gets stuck because they cannot find more consecutive numbers that add up to 26.
Such an assumption is not correct since 12 and 1 are continuous on a clock. Once that wrong assumption is removed, it becomes clear that and . So the second piece is 11, 12, 1 and 2; the third piece is 3, 4, 9 and 10.
Missing integers
Suppose we have 98 distinct integers from 1 to 100. What is a good way to find out the two missing integers (within [1, 100])?
19Solution: Denote the missing integers as and , and the existing ones are . Applying the summation equations, we have
Using these two equations, we can easily solve and . If you implement this strategy using a computer program, it is apparent that the algorithm has a complexity of for two missing integers in 1 to .
Counterfeit coins I
There are 10 bags with 100 identical coins in each bag. In all bags but one, each coin weighs 10 grams. However, all the coins in the counterfeit bag weigh either 9 or 11 grams. Can you find the counterfeit bag in only one weighing, using a digital scale that tells the exact weight?9
Solution: Yes, we can identify the counterfeit bag using one measurement. Take 1 coin out of the first bag, 2 out of the second bag, 3 out the third bag, …, and 10 coins out of the tenth bag. All together, there are coins. If there were no counterfeit coins, they should weigh 550 grams. Let’s assume the -th bag is the counterfeit bag, there will be counterfeit coins, so the final weight will be . Since is distinct for each bag, we can identify the counterfeit coin bag as well as whether the counterfeit coins are lighter or heavier than the real coins using .
This is not the only answer: we can choose other numbers of coins from each bag as long as they are all different numbers.
Glass balls
You are holding two glass balls in a 100-story building. If a ball is thrown out of the window, it will not break if the floor number is less than , and it will always break if 20the floor number is equal to or greater than . You would like to determine . What is the strategy that will minimize the number of drops for the worst case scenario?10
Solution: Suppose that we have a strategy with a maximum of throws. For the first throw of ball one, we can try the -th floor. If the ball breaks, we can start to try the second ball from the first floor and increase the floor number by one until the second ball breaks. At most, there are floors to test. So a maximum of throws are enough to cover all possibilities. If the first ball thrown out of -th floor does not break, we have throws left. This time we can only increase the floor number by for the first ball since the second ball can only cover floors if the first ball breaks. If the first ball thrown out of th floor does not break, we have throws left. So we can only increase the floor number by for the first ball since the second ball can only cover floors if the first ball breaks…
Using such logic, we can see that the number of floors that these two balls can cover with a maximum of throws is . In order to cover 100 stories, we need to have . Taking the smallest integer, we have . Basically, we start the first ball on the 14th floor, if the ball breaks, we can use the second ball to try floors with a maximum throws of 14 (when the 13th or the 14th floor is ). If the first ball does not break, we will try the first ball on the th floor. If it breaks, we can use the second ball to cover floors with a total maximum throws of 14 as well…