Infinitely many primes Since Euclid, we have known that there are infinitely many primes. The argument is by contradiction: If there are only finitely many, let's say \$p_1,p_2,...,p_n\$, then surely \$m:=p_1\cdot p_2\cdot...\cdot p_n+1\$ is not divisible by any of these primes, so its prime factorization must yield a new prime that was not in the list. So the assumption that only finitely primes exist is false.
Now let's assume that \$2\$ is the only prime. The method from above yields \$2+1=3\$ as a new (possible) prime. Applying the method again yields \$2\cdot 3+1=7\$, and then \$2\cdot 3\cdot 7+1=43\$, then \$2\cdot 3\cdot 7\cdot 43+1=13\cdot 139\$, so both \$13\$ and \$139\$ are new primes, etc. In the case where we get a composite number, we just take the least new prime. This results in A000945.
Challenge
Given a prime \$p_1\$ and an integer \$n\$ calculate the \$n\$-th term \$p_n\$ of the sequence defined as follows:
$$p_n := \min(\operatorname{primefactors}(p_1\cdot p_2\cdot ... \cdot p_{n-1} + 1))$$
These sequences are known as Euclid-Mullin-sequences.
Examples
For \$p_1 = 2\$:
1 2
2 3
3 7
4 43
5 13
6 53
7 5
8 6221671
9 38709183810571

For \$p_1 = 5\$ (A051308):
1 5
2 2
3 11
4 3
5 331
6 19
7 199
8 53
9 21888927391

For \$p_1 = 97\$  (A051330)
1 97
2 2
3 3
4 11
5 19
6 7
7 461
8 719
9 5
JavaScript (ES6),  45  44 bytes
Takes input as (n)(p1), where \$n\$ is 0-indexed.

n=&gt;g=(p,d=2)=&gt;n?~p%d?g(p,d+1):--n?g(p*d):d:p

Try it online!
Commented
n =&gt;                // n = 0-based index of the requested term
  g = (             // g is a recursive function taking:
    p,              //   p = current prime product
    d = 2           //   d = current divisor
  ) =&gt;              //
    n ?             // if n is not equal to 0:
      ~p % d ?      //   if d is not a divisor of ~p (i.e. not a divisor of p + 1):
        g(p, d + 1) //     increment d until it is
      :             //   else:
        --n ?       //     decrement n; if it's still not equal to 0:
          g(p * d)  //       do a recursive call with the updated prime product
        :           //     else:
          d         //       stop recursion and return d
    :               // else:
      p             //   don't do any recursion and return p right away