Seemingly tricky dice question-probability that one event occurs before another event?
Since neither A nor B cares about odd sums that aren't 7, we'll just reroll in those cases and thus we can ignore the probability of those sums occurring.
Thus we're left with 7 in addition to the 6 even sums ($2,4,6,8,10,12$).
The probabilities of these are respectively $6/36$ and $(1+3+5+5+3+1)/36 = 18/36$.
Divide the probabilities of each of these by the sum of both probabilities, to get $P(7)$ and $P(even)$ such that $P(7) + P(even) = 1$ (this is $P(7) = \frac{1}{4}$ and $P(even) = \frac{3}{4}$).
Now, as bobajob pointed out, the probability of A occurring before B is the complement of the probability of B occurring before A.
$P(2\ even\ before\ 4\ sevens) = 1-P(4\ sevens\ before\ 2\ even)$
To have 4 sums of seven before 2 even sums, there can be at most 1 even sum before the 4th seven sum.
Thus we have the following possible sequences:
$ 7\ 7\ 7\ 7$
$ 7\ 7\ 7\ even\ 7$
$ 7\ 7\ even\ 7\ 7$
$ 7\ even\ 7\ 7\ 7$
$ even\ 7\ 7\ 7\ 7$
Each of the above occurs with the following probability:
$ P(7) * P(7) * P(7) * P(7) = P(7)^4$
$ P(7) * P(7) * P(7) * P(even) * P(7) = P(even) * P(7)^4$
$ P(7) * P(7) * P(even) * P(7) * P(7) = P(even) * P(7)^4$
$ P(7) * P(even) * P(7) * P(7) * P(7) = P(even) * P(7)^4$
$ P(even) * P(7) * P(7) * P(7) * P(7) = P(even) * P(7)^4$
Then we have:
$P(2\ even\ before\ 4\ sevens) = 1-P(4\ sevens\ before\ 2\ even)$
$= 1 - P(7)^4 - 4 * P(even) * P(7)^4$
$= 1 - (\frac{1}{4})^4 - 4 * \frac{3}{4} * (\frac{1}{4})^4$
$= 0.984375$
Alternative method
The probability we want will just be the probability of getting 0-3 sums equal to 7 before getting 2 even sums.
$P(2\ even\ before\ 4\ sevens) = \sum_{i=0}^3P(i\ sevens\ before\ 2\ even)$
Since one even sum will need to be at the end, we can simply consider all possible positions of the other even sum.
Taking as an example $i=3$ (3 7 sums before 2 even sums), we'll have the following possible order of events:
$ 7\ 7\ 7\ even\ even$
$ 7\ 7\ even\ 7\ even$
$ 7\ even\ 7\ 7\ even$
$ even\ 7\ 7\ 7\ even$
The amount of these we have is simply $i + 1$.
Each of the above occurs with probability $P(even)^2 * P(7)^i$:
$ P(7) * P(7) * P(7) * P(even) * P(even) = P(even)^2 * P(7)^3$
$ P(7) * P(7) * P(even) * P(7) * P(even) = P(even)^2 * P(7)^3$
$ P(7) * P(even) * P(7) * P(7) * P(even) = P(even)^2 * P(7)^3$
$ P(even) * P(7) * P(7) * P(7) * P(even) = P(even)^2 * P(7)^3$
Thus we have:
$P(i\ sevens\ before\ 2\ even) = (i+1) * P(even)^2 * P(7)^i$
This gives us:
$P(2\ even\ before\ 4\ sevens) = \sum_{i=0}^3(i+1) * P(even)^2 * P(7)^i$
$= P(even)^2 * (1 + 2*P(7) + 3*P(7)^2 + 4*P(7)^3)$
$= (\frac{3}{4})^2 * (1 + 2*\frac{1}{4} + 3*(\frac{1}{4})^2 + 4*(\frac{1}{4})^3)$
$= 0.984375$
More generally, the positions of the even sums above will be a multiset permutation and one can come up with general expression for the probability of M events X occurring before N events Y, but that's a bit beyond the scope of this question.
I would do a Markov chain with the states being the number of even rolls/the number of seven rolls. Work backwards starting from the state that you have seen one even roll and three $7$s. What is the chance that A comes first from there?
You have two Bernoulli processes,$S_A$ and $S_B$, and you are asked about the probability that the 2nd arrival in $S_A$ process occurs before the 4th arrival in $S_B$ process. PMF of the time of $k$-th arrival in a Bernoulli process with probability of success $p$ is $$p_{X_k}(t)=\binom{t-1}{k-1}p^k(1-p)^{t-k}, \ t=k,k+1,\ldots$$
PS: the events "sum is even" and "sum is 7" are dependent, and it makes the question tricky indeed, and the trick is, as Dukeling explained, is to ignore odd sums not equal to $7$; then the (conditional) probability of getting the sum of $7$ is $\frac{6}{36-12}=\frac{1}{4}$. Now the complement of the event of interest is the event that the 4th arrival in the Bernoulli process with $p=1/4$ occurs at time $4$ or $5$, and its probability is equal to $$\binom{3}{3}p^4+\binom{4}{3}p^4(1-p)=p^4(1+4(1-p))=\frac{1}{64}$$ and the final answer is $$1-\frac{1}{64}=\frac{63}{64}$$