Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #11852 > unrolled thread
| Started by | James Stein <mathgroup@stein.org> |
|---|---|
| First post | 2012-09-23 07:00 +0000 |
| Last post | 2012-09-23 07:00 +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.
Re: Percentage of Primes James Stein <mathgroup@stein.org> - 2012-09-23 07:00 +0000
| From | James Stein <mathgroup@stein.org> |
|---|---|
| Date | 2012-09-23 07:00 +0000 |
| Subject | Re: Percentage of Primes |
| Message-ID | <k3mc1p$723$1@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@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
>
>
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web