You all are missing a possible explanation.
The prince knew the solution the entire time. Merely wanted someone else to state it.
If you think about it, his knowledge that Mary is probably interfering and his inference that the blonde isn't actually coming up with the solutions would allow him...