The Mathematics of Star Trek