Solution:
Let ak denote Alice's number after k seconds, and let pk be the smallest prime divisor of ak. We are given that a2022 is prime, and want to find a0.
If a0 is even, then an+1=an−2, since every an is even. Then we need a2022=2, so a0=4046.
If a0 is odd, then a1=a0−p0 is even, so by similar logic to the even case, a1=4044. Then since p0∣a0−p0 and 4044=4⋅3⋅337, we must have p0=3 or 337. But if p0=337, a0=12⋅337+337=13⋅337, so 337 is not the smallest prime divisor of a0. Thus, we need p0=3, so a0=4047, which works.
Thus, the final answer is 4046+4047=8093.