Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

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

Search the Archive

Re: Percentage of Primes

  • To: mathgroup at smc.vnet.net
  • Subject: [mg128195] Re: Percentage of Primes
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Sun, 23 Sep 2012 02:59:53 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net

On 9/22/12 at 2:47 AM, eggers.jared at gmail.com (Jared E) wrote:

>I'm brand new to Mathematica, so there's only so much I can teach
>myself by playing around with it.  Could somebody give me some
>sample code for displaying a graph of the percentage of primes from,
>say, 1 to 1000.  The x-axis would be the integers from 1 to 1000 and
>the y-axis would indicate the density of primes from 1 to n.  I can
>then figure out how to apply this code to other types of problems.

Code for doing what you describe is pretty simple if you take
use of built-in functions Mathematica offers. For example,

DiscretePlot[PrimePi[n]/n, {n, 2, 1000}, PlotRange -> All]

or perhaps a log scale provides a better display

ListLogPlot[Table[{n, PrimePi[n]/n}, {n, 2, 1000}], PlotRange -> All]






  • Prev by Date: Re: Front end - Error when saving file
  • Next by Date: Re: Percentage of Primes
  • Previous by thread: Re: Percentage of Primes
  • Next by thread: Re: Percentage of Primes