Here, Abigail has too many possibilities: each time she can potentially get two different results, so if Tristan has a hope of winning, he would like that at the n-th turn, Abigail has only one possibility modulo p:bn. Initially, he chooses X=b0. Then, from bn, to have only one possibility, he would like to choose an+1 such that an+1bn≡an+1+bn(modp), i.e., an+1≡1−bnbn(modp). In particular, we will have bn+1≡bn−1bn2(modp). It is noted that having bn≡1(modp) is a problem for Tristan.
Thus, let's give the following strategy for Tristan: Tristan chooses an X that is not congruent to 0 or 1 modp. He sets b0=X. Then, as long as bn is not 1 modulo p, he sets an+1≡bn−1bn(modp) and bn+1≡bn−1bn2(modp). We can show by immediate induction that Abigail, after n choices, will have written bn(modp) on the board.
We can hope that for all n,an is always defined and bn is always different from 0 and 1 modulo p. Note that if bn=0,1(modp),bn+1=0(modp). Moreover, bn+1≡1(modp) is equivalent to bn2−bn+1≡0(modp). This polynomial has a root modulo p if and only if its discriminant, -3, is a square modulo p.
By quadratic reciprocity,
(p−3)=(p−1)(p3)=(−1)2p−1(−1)42(p−1)(3p)=(3p)
In particular, this gives us the question a: since p≡2(mod3),(p−3)=−1, so the equation x2−x+1≡0(modp) has no solution: thus bn+1 cannot be 1 modulo p, so Tristan wins.
For question b, unfortunately, we cannot ensure that the previous process works. One option is that bn quickly loops. Since bn+1≡bn+an+1≡bnan+1, if bn+1≡bn,an+1≡0(modp), so bn+1≡0(modp). The best we can hope for is to have a loop of size 2, i.e., b2≡b0(modp).
Now,
b2≡b1−1b12≡b0−1b02−1(b0−1)2b04
The equation (with x≡0(modp))x≡x−1x2−1(x−1)2x4 is equivalent to 1≡x2(x−1)−(x−1)2x3≡ x3−2x2+2x−1x3, and thus to 2x2−2x+1≡0(modp), and this makes sense provided that x is different from 0 and 1 modulo x and x−1x2 is different from 0 or 1 modulo p.
The equation 2x2−2x+1≡0(modp) is a quadratic equation, which has a solution modulo p if and only if its discriminant, which is -4, is a square modulo p. -4 is a square if and only if -1 is. In b, since p≡1(mod4), -1 is indeed a square: there exists a root modulo p of 2x2−2x+1, which we will denote by y. 0 and 1 not being roots, y is different from 0 or 1. Moreover, we cannot have y−1y2≡0 or 1 modulo p: for 0, this is clear, for 1, this would imply having y2−y≡1, so 2y2−2x≡2. But 2y2−2y≡−1, and 2≡−1(modp). Thus, if we take X=y, we obtain by immediate induction that bn≡b0 if n is even, b1 if n is odd, and is different from 0 and 1 for all n⩾0. Thus Abigail cannot win: in both cases, Tristan wins.