The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Inactive » comp.soft-sys.math.mathematica

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Re: Mma: 13 is not prime!
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
Harald Berndt

Posts: 24
Registered: 12/7/04
Re: Mma: 13 is not prime!
Posted: Aug 16, 1996 3:01 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Felix Holderied wrote:
> Please help me:
> In[]:=
> PrimeQ[13]
> Out[]=
> True
> In[]:=
> PrimeQ[p] /.{p->13}
> Out[]=
> False
> WHY?
> Greetings, Felix

It's all in the evaluation order! Basically, you get the answer for


which is evaluated before the replacement takes place (and has of
course the result False). Try instead

ReleaseHold[ Hold[PrimeQ[p]] /.{p->13} ]

Harald Berndt University of California
Research Specialist Forest Products Laboratory
Phone: 510-215-4224 FAX:510-215-4299

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.