Chartboost Interview Question

Write a function to detect whether a number is prime.