PrimeQ
PrimeQ[n]
returns True if n
is prime, False otherwise.
Attributes[PrimeQ] := {Listable, Protected}
Simple examples
In[1]:= PrimeQ[5] Out[1]= True
In[2]:= PrimeQ[100] Out[2]= False
In[3]:= PrimeQ[982451653] Out[3]= True
In[4]:= PrimeQ[-2] Out[4]= True
Further examples
PrimeQ
only works for Integers:
In[1]:= PrimeQ[5.] Out[1]= False