How do I define this subset using mathematical notation? Assume $P = \{2, 3, 5, 7, 11, 13, 17, 19, 23,....\}$ or in another words, P is the set consisting of all prime numbers.
Now, suppose we want to form the set $S$, which is subset of $P$,and  whose elements are the first 100 prime numbers.
How do I define subset S using mathematical notation?
My two attempts were:


*

*$S = \{x \in P \mid x ≤ m\}$ (where m is the 100th prime number) This method will only work when we know the exact value of m.

*$S = \{x_{i} \in P \mid  1 ≤ i ≤ 100\}$ (I believe this method is also incorrect, as sets do not support indexing)
So what will be the correct way of defining subset $S$?
 A: Good question!
First, let me point out that I agree with your objections to the two approaches given in the question. (1) requires us to first define $m$ in some way, and (2) doesn't make sense.
Generally, I agree with @Vsotvep: The best way of describing $S$ is to write something using plain English, like "the set of the first 100 prime numbers" or "the set of the 100 smallest primes". But of course, there are infinitely many ways you can express this in a more complicated way by referring to $P$. Just two examples:


*

*$S$ is the unique subset of $P$ such that $|S| = 100$ and $S = \{ p \in P : p \le M\}$ for some real number $M$.

*$S$ is the unique subset of $P$ satisfying $|S| = 100$ and $\sum_{s \in S} s \le \sum_{x \in X} x$ for every subset $X$ of $P$ such that $|X| = 100$.


But I also agree with @Henning Makholm: You seem already to have defined the sequence of prime numbers, since you refer to things like "the first 100 prime numbers" and "the 100th prime number". Just give this sequence a symbol, such as $(p_i)_{i=1}^\infty$, and you can also write
$$S = \{p_1, p_2, \dots, p_{100}\}$$
or, if you want it to look just slightly more complicated,
$$S = \bigcup_{i = 1}^{100} \{p_i\}.$$
(Also correct, but rather clumsy: $S = \{ p \in P : p \le p_{100}\}$.)

When writing mathematics, the goal is that the text should be easy to understand and precise -- you should always know exactly what is intended, how symbols are defined, etc., and the text should not contain any logical errors, ambiguities, etc. This is much more important than always using symbols -- symbols are used when they aid in the aforementioned goal.
Bonus discussion. You wrote

Assume $P = \{2, 3, 5, 7, 11, 13, 17, 19, 23, \dots.\}$ or in another words, $P$ is the set consisting of all prime numbers.

Here I do see a small deviation from rigour. Can you spot it? :)
A: It is common to use the notation $p_i$ for the $i$th prime, so you could write
$$ \{p_1, p_2, p_3, \ldots, p_{100} \} $$
Attempting to make it "more symbolic" (as if the mathematical notation were a programming language rather than a means of communicating ideas to human readers) will only make it less clear to your readers what you mean, and most probably will not serve any useful purpose.
A: The whole point of giving an abstract definition of the set of the first $100$ primes, is that you don't want to compute primes or use a lookup table. So in order to give the definition of the set of the first $100$ primes, it is no problem that you don't know the $100$'th prime, so I would say both approaches are fine, although I would replace $m$ in your first definition by ${x_{100}}$, or better yet, since we are talking about primes, $p_{100}$, where $p_{i}$ is the $i$'th prime.
A: The set of primes are often defined as $\mathbb{P}$.
Afaik, the proper subset $S$ of the superset $\mathbb{P}$ is defined as:
Let $S \subset \mathbb{P}$. Then $s \in S$.
The notation $(s_n)_{n=1}^{100}$ denotes the $100$-term sequence of primes.
I think also you could write it as:
Let $S=[1,100]$, a closed interval of $\mathbb{P}$.
The interval is right-closed because it has a maximum. Could some expert re-edit my post if i got that last bit wrong.
