Question about 12-tone musical scale and rational approximations On a modern tuned instrument, an octave has twelve notes with a common frequency ratio of $2^{\frac{1}{12}}$ 
Of course, twelve is a very good choice for the number of notes, as 
$2^\frac{12}{12}=1$
$2^{\frac{7}{12}}$ is very close to $\frac{3}{2}$, 
$2^\frac{5}{12}$ is very close to $\frac{4}{3}$
$2^{\frac{4}{12}}$ is very close to $\frac{5}{4}$
Those are the simplest possible ratios and thus produce the most harmonious chords, so it seems quite natural that it was adopted.
But why is a twelve tone system the best for approximating these fractions? 
Mathematically, here is the question: 
Let $S_n$ be the set of all $2^{\frac{i}{n}}$ for some $n$
For which values of $n$ are the elements of $S_n$ closely approximated by rational numbers $\frac{a}{b}$ where $a,b$ are small natural numbers?
 A: The accuracy of a particular interval when compared to the perfect (just) ratio is measured in cents, with one cents being a logarithmic unit with 1 cent calibrated to 0.01 semitones on a 12-tone equal-tempered scale
$12$ is very good for approximating a variety of different ratios quite accurately, especially the perfect 5th and 4th (the simplest ratios of $\frac{3}{2}$ and $\frac{4}{3}$ are approximated to a very accurate degree-only 2 cents off
One point to be noted, of course, is that in any equal-temperament scale, the perfect fifth and perfect fourth will be equally well approximated. This is proved below
Say that the $a^{th}$ and $b^{th}$ degrees of the scale approximate the ratios $4/3$ and $3/2$ respectively. Then the following represent their distance from just intonation (the amount by which the perfect fourth and fifth intervals are "of tune")
All logarithms are to the base of $2^{1/n}$ where $n$ is the number of intervals
$log(3/2)-a=log(3)-log(2)-a$ 
$b-log(4/3)=b-2log(2)+log(3)$
Note that the difference between the RHS's above is clearly an integer (as $log(2)$ is an integer)
As the error in semitones is by definition less than $1$ (otherwise a and b would not be the best interval degrees), it is clear that both approximations are off by the same amount
Such intervals such as $4/3$ and $3/2$ are called "complementary intervals".
If we are only concerned with the best way to approximate these two ratios we can use https://oeis.org/A060528 to do so.
From a practical standpoint, for any widely applicable music system, we would want our number of intervals to be in that sequence, as the perfect fifth and fourth are by far the most significant ratios in music. 
Furthermore, as there are relatively few ratios which are harmonious to the human ear, a scale with too many intervals would have too many dissonant sounding notes, simply by PHP. 
The twelve-tone scale was selected in Europe in the 18th century due to both practical and mathematical factors
Since then, twelve tone equal temperament scale has largely taken precedence all over the world due to the mixing of cultures over the past few hundred years.
So, in conclusion, no, 12 is not the only number possible. However, due to the consonance-spotting capacity of human ear, it belongs to a very short list of possible numbers that could have worked.
Once selected, it worked well enough, there was never a need to change it.
