Not only that, they wrote part of this math into a monologue for Dr. McCoy, where McCoy was advising Kirk.
In this galaxy, there's a mathematical probability of three million Earth-type planets. And in all of the universe, three million million galaxies like this. And in all of that... and perhaps more, only one of each of us.
Don't destroy the one named Kirk.
From the episode Balance of Terror: