Mortgage Cadence Interview Question

How would you make a prime checking function more efficient?