To understand how the notes are tuned in modern pianos, and why this system of tuning has been adopted, you need to understand the relationship of the intervals between the notes to the mathematical concept of logarithms.

One of the things you are asked to do in this problem is to find how many thirds there are in an octave using logarithms. Going back in history, musicians would have used other methods to calculate how many thirds in an octave because they did not know about logarithms. The problem Euclid's Algorithm and Musical Intervals is about a method they used.

There are many musical scales but in this problem we only consider the 12 note piano scale.

An octave is the interval from any note to the next occurrence of that note up or down the keyboard. There are 12 notes in an octave. The black notes on the piano keyboard are sharps or flats, for example the note between C and D is called C sharp or D flat.

The musical intervals correspond to the ratios of the lengths of the strings which vibrate to produce the notes, for example the octave is given by doubling (or halving) the length of the string. If you halve the length of a string the pitch rises an octave, that is from one C to the next C above it, or from one A to the next A above it, and so on, so the associated ratio for this musical interval is 2.

Similarly by taking 2/3 of the length of the string the pitch rises by what musicians call a fifth, that is from C to G and taking 3/4 the length the pitch goes up by a fourth, from C to F say. Pleasant harmonies arise from notes whose frequencies are related by simple ratios.

Taking eight-ninths of the original string gives the interval called the tone (C to D above it or anything similar).

If the interval between two notes is a ratio of small integers the notes sound good together. The pure intervals smaller than or equal to an octave are: 2/1 - the octave; 3/2 - the perfect fifth; 4/3 - the perfect fourth; 5/4 - the major third; 6/5 - the minor third; 5/3 - the major sixth and 8/5 - the minor sixth.

Although some of the intervals in the just intonation system are perfect, other combinations of notes sound very bad. With equal temperament, the intervals are never exact (except the octave), but they are very close - always within about one percent or better. The twelve-tone equal-tempered scale is the smallest equal-tempered scale that contains all six of the pure intervals 3/2, 4/3, 5/4, 6/5, 5/3, 8/5 to a good approximation - within one percent.