Solution for primechecker problem.