99 Bottles of Beer

From testwiki
Revision as of 04:08, 16 February 2025 by imported>Guy Harris (Mathematically inspired variants: Use what the article considers the primary title of the song.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Template:Short description Template:Use mdy dates "99 Bottles of Beer" or "100 Bottles of Pop on the Wall" is a traditional reverse counting song from the United States and Canada. It is popular to sing on road trips, as it has a very repetitive format which is easy to memorize and can take a long time when sung in full. In particular, the song is often sung by children on long school bus trips, such as class field trips, or on Scout or Girl Guide outings. 99 Bottles of Beer's lyrics can be printed in normal programming languages or esoteric programming languages.

History

Template:Failed verification span <score sound> { \key d \major \relative c'

{ d8 d d4 fis8 a4. e8 e e fis d4 r
  d'8 d d4 d8 a4. b8 b cis d a4 r
  d d8 d d2 b4 d a2
  d,8 d d4 fis8 a4. e8 e e fis d2 \bar ":|." }
\addlyrics { For -- ty nine bot -- tles hang -- ing on the wall,
  For -- ty nine bot -- tles ha -- nging on the wall,
  Take one a -- way from them all,
  For -- ty eight bott -- les hang -- ing on the wall. }

} </score> Template:Failed verification span

Lyrics

Template:Listen The song's lyrics are as follows, beginning with n=99:[1][2] <poem style="margin-left: 2em;">(n) bottles of beer on the wall. (n) bottles of beer. If one of the bottles just happen to fall, (n−1) bottles of beer on the wall.</poem>

<score sound> \layout { \set Score.tempoHideNote = ##t \context { \Score \remove "Bar_number_engraver" } } { \key g \major \time 3/4 \tempo 4.=210 \set Staff.midiInstrument = #"harmonica" \relative c

 { g4 g g | d d d | g g g | g2. |
   a4 a a | e e e | a2.~ | a2. |
   fis2 fis4 | fis2. | fis4 fis fis | fis2. |
   d4 d d | d e fis | g g g | g2. \bar ":|."
 }
 \addlyrics { Nine -- ty nine bot -- tles of beer on the wall,
 nine -- ty nine bot -- tles of beer.
 Take one down, pass it a -- round,
 nine -- ty eight bot -- tles of beer on the wall.}

} </score>[3]

The same verse is repeated, each time with one bottle fewer, until there is none left. Variations on the last verse following the last bottle going down include lines such as: <poem style="margin-left: 2em;">No more bottles of beer on the wall, no more bottles of beer. Go to the store and buy some more, 99 bottles of beer on the wall...</poem>

Or: <poem style="margin-left: 2em;">No more bottles of beer on the wall, no more bottles of beer. We've taken them down and passed them around; now we're drunk and passed out!</poem>

Other alternate lines read: <poem style="margin-left: 2em;">If that one bottle should happen to fall, what a waste of alcohol!</poem>

Or: <poem style="margin-left: 2em;">No more bottles of beer on the wall, no more bottles of beer. There's nothing else to fall, because there's no more bottles of beer on the wall.</poem>

Or the song does not stop at the last "1" or "0" bottles of beer but continues counting with −1 (Negative one) Bottles of beer on the wall Take one down, pass it around, −2 (negative 2) bottles of beer on the wall... continuing onward through the negative numbers.

Full-length recitals

Singing all verses takes an extraordinarily long time. The American comedian Andy Kaufman used this for comedic effect early in his career when he actually sang all 100 verses.[4]

Atticus, a band from Knoxville, Tennessee, recorded a thirteen and a half minute live version of the song in its entirety at the Glasgow Cathouse in Scotland. It was included in the 2001 album Figment. Rich Stewart aka Homebrew Stew listed it as the number one drinking song out of 86 in an article for Modern Drunkard Magazine the following year.[5]

Mathematically inspired variants

Donald Byrd has collected dozens of variants inspired by mathematical concepts and written by himself and others.[6] (A subset of his collection has been published.[7]) Byrd argues that the collection has pedagogic as well as amusement value. Among his variants are:

  • "Infinity bottles of beer on the wall". If one bottle is taken down, there are still infinite bottles of beer on the wall (thus creating an unending sequence much like "The Song That Doesn't End").
    • "Aleph-null bottles of beer on the wall". Aleph-null is the size of the set of all natural numbers, and is the smallest infinity and the only countable one; therefore, even if an infinite aleph-null of bottles fall, the same amount remains.
    • "Aleph-one/two/three/etc. bottles of beer on the wall". Aleph-one, two, three, etc. are uncountable infinite sets, which are larger than countable ones; therefore, if only a countable infinity of bottles fall, an uncountable number remains.

Other versions in Byrd's collection involve concepts including geometric progressions, differentials, Euler's identity, complex numbers, summation notation, the Cantor set, the Fibonacci sequence, and the continuum hypothesis, among others.

References in computer science

The computer scientist Donald Knuth proved that the song has a complexity of O(logN) in his in-joke-article "The Complexity of Songs".[8]

Numerous computer programs exist to output the lyrics to the song. This is analogous to "Hello, World!" programs, with the addition of a loop. As with "Hello, World!", this can be a practice exercise for those studying computer programming, and a demonstration of different programming paradigms dealing with looping constructs and syntactic differences between programming languages within a paradigm.

The program has been written in over 1,500 different programming languages.[9]

Example

#include <stdio.h>

int main(void) {
  for (size_t i = 99; i > 0; i--) {
    printf("%zu bottle%s of beer on the wall, %zu bottle%s of beer.\nTake one down & pass it around, now there's ",
           i, (i == 1 ? "" : "s"), i, (i == 1 ? "" : "s"));

    printf((i > 1) ? "%zu bottle%s of beer on the wall\n"
                   : "no more bottles of beer on the wall!\n",
           i - 1, i==2?"":"s");
  }
}
fn main() {
    for i in (3..100).rev() {
        println!("{i} bottles of beer on the wall, {i} bottles of beer.\nTake one down and pass it around, now there's {} more bottles of beer on the wall!", (i - 1));
    }
    println!("2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, now there's 1 more bottle of beer on the wall!", );
    println!("1 bottle of beer on the wall, 1 bottle of beer.\nTake one down and pass it around, there's no more bottles of beer on the wall!");
}
verses :: [String]
verses =
    "1 bottle of beer on the wall, 1 bottle of beer.\nTake one down and pass it around, there's no more bottles of beer on the wall!"
    : "2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, now there's 1 more bottle of beer on the wall!"
    : map (\n -> show n
        ++ " bottles of beer on the wall, " 
        ++ show n
        ++ " bottles of beer.\nTake one down and pass it around, now there's "
        ++ show (n-1)
        ++ " more bottles of beer on the wall!") [3..]

main :: IO ()
main = mapM_ putStrLn (reverse $ take 99 verses)
for i in range(99,0,-1):
  print(i,"bottles of beer on the wall,",i,"bottles of beer.")
  
  if i != 1:
    print("Take one down and pass it around, now there's",i-1,"more bottles of beer on the wall!")

  else:
    print("Take one down and pass it around, there's no more bottles of beer on the wall!")

See also

References

Template:Reflist

Template:Authority control