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