Refactor prime number test for failing case