Background
Consider the following sequence (A051935 in OEIS):
- Start with the term \$2\$.
- Find the lowest integer \$n\$ greater than \$2\$ such that \$2+n\$ is prime.
- Find the lowest integer \$n'\$ greater than \$n\$ such that \$2 + n + n'\$ is prime etc.
A more formal definition:
$$a_n=\begin{cases}2 & \text{if }n=0 \\ \min\{x\in\Bbb{N}\mid x>a_{n-1} \text{ and }\left(x+\sum_{i=0}^{n-1}a_i\right) \text{ is prime}\} & \text{otherwise}\end{cases}$$
The first few terms of the sequence are (please refer to these as test cases):
2, 3, 6, 8, 10, 12, 18, 20, 22, 26, 30, 34, 36, 42, 44, 46, 50, 52, 60, 66, 72, 74, ...
Task
Your task is to generate this sequence in any of the following ways:
- Output its terms indefinitely.
- Given \$n\$, output \$a_{n}\$ (\$n^{\text{th}}\$ term, \$0\$ or \$1\$ indexed).
- Given \$n\$, output \$\{a_1, a_2, \dots, a_n\}\$ (first \$n\$ terms).
You can compete in any programming language and can take input and provide output through any standard method, while taking note that these loopholes are forbidden by default. This is code-golf, so the shortest submission (in bytes) for every language wins.