Made brute force isPrime a recursive function and removed imperative implementation