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


Groups > comp.soft-sys.math.mathematica > #11859 > unrolled thread

Re: Percentage of Primes

Started byBob Hanlon <hanlonr357@gmail.com>
First post2012-09-23 07:16 +0000
Last post2012-09-23 07:16 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Percentage of Primes Bob Hanlon <hanlonr357@gmail.com> - 2012-09-23 07:16 +0000

#11859 — Re: Percentage of Primes

FromBob Hanlon <hanlonr357@gmail.com>
Date2012-09-23 07:16 +0000
SubjectRe: Percentage of Primes
Message-ID<k3md0g$793$1@smc.vnet.net>
Minimalist approach:

ListPlot[
 Count[Range[#], _?PrimeQ]/# & /@
  Range[1000]]

With bells and whistles:

Manipulate[
 Module[{data, pt},
  data = Count[Range[#], _?PrimeQ]/# & /@
    Range[nmax];
  pt = {nmax, data[[-1]]};
  ListPlot[
   data,
   Frame -> True,
   Axes -> False,
   PlotRange -> {-0.02, 0.7},
   MaxPlotPoints -> 150,
   PlotStyle -> Darker[Red],
   Epilog -> {Blue, AbsolutePointSize[2],
     Point[pt],
     Text[
      NumberForm[N[data[[-1]]], {4, 3}],
      pt, {1, 2}]}]],
 {nmax, 25, 1000, 25,
  Appearance -> "Labeled"}]


Bob Hanlon


On Sat, Sep 22, 2012 at 2:47 AM, Jared E <eggers.jared@gmail.com> 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-ax is 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.  Thanks, Jared
>

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web