With and without the comma, the sentence will mean two different things. Without the comma, the sentence means probably what you are looking for, that John is the only one who can solve the math problem. With the comma, the sentence would mean that John is the only person here at all, and his ability to solve the math problem is secondary.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.