Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


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

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

PrimeQ[p]

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

In[93]:=
ReleaseHold[ Hold[PrimeQ[p]] /.{p->13} ]
Out[93]=
True

--
_______________________________________________________________
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]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.