Mortgage Cadence interview question

How would you make a prime checking function more efficient?