Implemented isPrime and tested it.