We are given that he says he does know and have no reason to doubt it. It is possible that Peter and Sandy know one another and already know that they are perfect at figuring out maths/logic puzzles.
They both need to say they know, otherwise we have no reason to believe Sandy has figured it out.
And they both need to be right, which we also have no reason to believe at the moment.