Mathematica 9 is now available
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: [mg128196] Re: Percentage of Primes
  • From: James Stein <mathgroup at stein.org>
  • Date: Sun, 23 Sep 2012 03:00:13 -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
  • References: <20120922064747.0DFD4685F@smc.vnet.net>

I think you have not spend much time with the "Core Language" tutorial.
A little reading at the beginning will pay big dividends.
For what is's worth, here's relatively simple code:

Clear [ f ] ;
f [ 1 ] = 0 ;
f [ n_ ] := f [ n ] = f [ n - 1 ] + If [ PrimeQ [ n ], 1, 0 ] ;
ListPlot [ Table [ f [ k ] / k, { k, 1000 } ] ]


On Fri, Sep 21, 2012 at 11:47 PM, Jared E <eggers.jared at 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-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.  Thanks, Jared
>
>




  • Prev by Date: Re: Percentage of Primes
  • Next by Date: Re: creating a graphic in a text cell
  • Previous by thread: Re: Percentage of Primes
  • Next by thread: Re: Percentage of Primes