Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #11851

Re: Percentage of Primes

From Bill Rowe <readnews@sbcglobal.net>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Percentage of Primes
Date 2012-09-23 06:59 +0000
Message-ID <k3mc1e$721$1@smc.vnet.net> (permalink)
Organization Time-Warner Telecom

Show all headers | View raw


On 9/22/12 at 2:47 AM, eggers.jared@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]



Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Percentage of Primes Bill Rowe <readnews@sbcglobal.net> - 2012-09-23 06:59 +0000

csiph-web