There are various tests to see if a number is prime. The simplest is simply manually checking for prime factors up to the root of the number you're checking. That's good enough to get you an excellent score on GMAT.
If you're interested in this area of Math, then check out the following video. But beware, using a method such as this one
will likely take too much time to be worth doing for any GMAT problem:
https://www.youtube.com/watch?v=HvMSRWTE2mI