Learning Scientific Programming with Python (2nd edition)
Q2.2.7: Deducing the top-face value of a die
Question Q2.2.7
If two adjacent sides of a regular, 6-sided die have the values $a$ and $b$ when viewed side-on and read left-to-right, the value on the top of the die is given by $3(a^3b - ab^3)\mod 7$.
Determine the value on the top of the die if (a) $a=2, b=6$, (b) $a=3, b=5$.