PTC Interview Question

Write a program to determine if a given number is a prime number. Then, optimize your solution to improve its efficiency.