Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: plot primes only

  • To: mathgroup at smc.vnet.net
  • Subject: [mg88734] Re: plot primes only
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Thu, 15 May 2008 06:51:00 -0400 (EDT)

On 5/14/08 at 6:06 AM, markus.mooslechner at chello.at (markus
mooslechner) wrote:

>a quick one: how can i tell mathematica to only list the primes from
>a list of data and omit the others? primeQ only tells me the boolean
>result

There are a number of ways to do this. For example,

In[1]:= Cases[Range@10, _?PrimeQ]

Out[1]= {2,3,5,7}

or

In[2]:= Select[Range@10, PrimeQ]

Out[2]= {2,3,5,7}


  • Prev by Date: Re: Expression manipulation
  • Next by Date: Multiple clipboards
  • Previous by thread: Re: plot primes only
  • Next by thread: export mathematica table to .mat (MATLAB) format.Please help!!!