It is not actually. It is more my stupid mistake for saying that in the end of my comment ;P. As you can see the first reply to my comment explains that I am wrong in a funny way :D.
Again sorry for the last part of my comment and thanks for the reply.
How is this O(n/2) if you're still doing ~n comparisons? The loop runs n/2 times but you do 2 comparisons per loop. O(n) is still great though, better than sorting
that's the ternary operator EDIT: note that the second option is a recursive call (!)
Can someone explain what is happening after the return statement? with the question mark?
This solution is mind blowing for me. Smart!
I mean no matter how many times you run the test, there will be still a marginal chance that the code fails to identify whether the number is prime or composite. That is just the nature of probabilistic prime checking.