All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Just Math
Endless Summer (Posted on 2003-10-20) Difficulty: 2 of 5
Suppose that the song "99 Bottles of Beer on the Wall" was sung from beginning to end.

What would be the sum of all the numbers (including repeats, of course) in the song?

Then, suppose you have some arbitrary number n bottles, which you would like to sing about. Find a formula in terms of n for the sum of all the numbers you will be singing.

  Submitted by DJ    
Rating: 4.0000 (9 votes)
Solution: (Hide)
14,850

Start with the first verse:

"99 bottles of beer on the wall, 99 bottles of beer; take one down, pass it around, 98 bottles of beer on the wall."

There are four numbers mentioned in the verse:

99 99  1 98
The next time around, each of these will decrement by one, except, of course, for the one itself (the same goes for each subsequent verse):
99 99  1 98
98 98  1 97
97 97  1 96
 .
 .
 .
 2  2  1  1
 1  1  1  0
Here is where a few tricks may prove useful.
First, notice that the sum of the third column is going to be 99 (one for each of the 99 verses), so if that 99 is placed atop the last column, the total is simply three times the sum from 1 to 99 (equivalently, three times the sum from 0 to 99).
That sum is easily found as the sum of sets of pairs:
99 + 0 + 98 + 1 + ... + 50 + 49
where each pair adds up to 99.

There are 50 pairs in the series, and the total we are looking for is three times that sum, so the answer is simply:
99 * 150 = 14850

If you start with n bottles, it is much the same:

n    n    1    n-1
n-1  n-1  1    n-2
.
.
.
2    1    1    1
1    1    1    0
Again, there are n rows, so the sum of the column of ones is just n, which appended to the top of the last column yields n + n+1 + ... + 1, and an overall sum of three times that, 3(n + n+1 + ... + 1). The sum of the first n numbers (1 + 2 + ... + n) is n(n+1)/2, so the overall sum for the song involving n bottles is (3n/2)(n+1).

Just to check, for n=99, this formula becomes:
(3(99)/2)(100) = 3(99)(50) = 14850

which is what we arrived at previously.

Comments: ( You must be logged in to post comments.)
  Subject Author Date
Solution'Official Solution' missed the final verseDej Mar2008-09-05 02:53:48
AnswerK Sengupta2008-09-04 13:20:41
Solutionan answerlogischer Verstand2004-03-21 22:54:44
dont knowMinion1232003-11-13 00:20:24
hmm...Victor Zapana2003-10-29 20:12:23
Solutionethan2003-10-20 16:52:35
solutionLee2003-10-20 12:16:04
Solutionre: Solution 2nd partfwaff2003-10-20 09:15:17
SolutionSolutionRoyCook2003-10-20 08:39:04
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (7)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information