<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE document PUBLIC "-//CNX//DTD CNXML 0.5 plus MathML//EN" "http://cnx.rice.edu/cnxml/0.5/DTD/cnxml_mathml.dtd">
<document xmlns="http://cnx.rice.edu/cnxml" xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="None">
  <name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">The Prime Number Theorem (PNT)</name>
  <metadata xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
  <md:version xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">**new**</md:version>
  <md:created xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">2004/07/07 15:32:06.846 GMT-5</md:created>
  <md:revised xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">2005/04/03 00:08:48.103 US/Central</md:revised>
  <md:authorlist xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
      <md:author xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="fcm">
      <md:firstname xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">F.</md:firstname>
      <md:othername xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Curtis</md:othername>
      <md:surname xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Michel</md:surname>
      <md:email xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">fcm@rice.edu</md:email>
    </md:author>
  </md:authorlist>

  <md:maintainerlist xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
    <md:maintainer xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="fcm">
      <md:firstname xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">F.</md:firstname>
      <md:othername xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Curtis</md:othername>
      <md:surname xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Michel</md:surname>
      <md:email xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">fcm@rice.edu</md:email>
    </md:maintainer>
    <md:maintainer xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="gpicazo">
      <md:firstname xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Genaro</md:firstname>
      
      <md:surname xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Picazo</md:surname>
      <md:email xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">picazo@rice.edu</md:email>
    </md:maintainer>
    <md:maintainer xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="jsilv">
      <md:firstname xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Jeffrey</md:firstname>
      
      <md:surname xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Silverman</md:surname>
      <md:email xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">jsilv@rice.edu</md:email>
    </md:maintainer>
  </md:maintainerlist>
  
  

  <md:abstract xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">The Prime Number Theorem is of key interest to number theorists owing to the importance of Riemann's work on the subject.
But it can also be viewed as a fitting function that approximates the distribution of the prime numbers.  We provide such a "pedestrian" viewpoint and development using elementary mathematics.</md:abstract>
</metadata>

  <content xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
    <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="para1">
      The famous mathematician Bernhard Riemann did some novel and
      exciting work in 1859 on the old question of how many primes there are
      below a given number, which is usually written
      <m:math display="block">
	<m:apply>
	  <m:ci type="fn">π</m:ci>
	  <m:ci>n</m:ci>
	</m:apply>
      </m:math>
      This function is equivalent to asking, "what is the value of the
      <m:math><m:ci>k</m:ci></m:math>-th prime for any given <m:math><m:ci>k</m:ci></m:math>?" The latter is actually a more
      specific question since an arbitrary
      <m:math><m:ci>n</m:ci></m:math> will in general fall between
      primes. Indeed, the notation is most curious because
      <m:math><m:ci type="fn">π</m:ci></m:math> refers to the number of primes up to
      <m:math><m:ci>n</m:ci></m:math>, not to any prime <foreign xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">per se</foreign>, while
      <m:math><m:ci>n</m:ci></m:math> actually refers to the values of
      the primes (since <m:math><m:ci type="fn">π</m:ci></m:math> changes by unity
      every time 
      <m:math><m:ci>n</m:ci></m:math>
      passes through a prime value.  Thus if
      <m:math><m:ci>n</m:ci></m:math> is a prime, it is
      the <m:math><m:ci type="fn">π</m:ci></m:math>-th prime, pretty much the inverse
      of defining a function 
      <m:math display="block">
	<m:apply>
	  <m:ci type="fn">p</m:ci>
	  <m:ci>n</m:ci>
	</m:apply>
      </m:math>
      where <m:math><m:ci type="fn">p</m:ci></m:math> is the value of the
      <m:math><m:ci>n</m:ci></m:math>-th prime. We will encounter
      this inversion as a practical matter later.  However, it is a testiment
      to Riemann's genius that he derived closed expressions that gave
      the exact number of primes.  For example, the 4th prime is 7, but
      if you chose <m:math><m:apply><m:eq/><m:ci>n</m:ci><m:ci><m:mrow><m:mn>8</m:mn><m:mo>,</m:mo><m:mn>9</m:mn><m:mo>,</m:mo><m:mn>10</m:mn></m:mrow></m:ci></m:apply></m:math>, Riemann's formula will give the same
      answer (4) for each of these values for <m:math><m:ci>n</m:ci></m:math>.  For this reason, the
      notation seems reversed, but actually makes sense.
    </para>

    <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="para2">
      The PNT as a theorem asserts that the following interpolation
      formulas, which attempt to smoothly fit onto the trends in the
      distribution of the primes, are asymptotically exact.
    </para>

    <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="para3">
      An early estimate was that 
      <m:math>
	<m:apply>
	  <m:ci type="fn">π</m:ci>
	  <m:ci>n</m:ci>
	</m:apply>
      </m:math>
      was approximately 
      <m:math display="block">
	<m:apply>
	  <m:divide/>
	  <m:ci>n</m:ci>
	  <m:apply>
	    <m:ln/>
	    <m:ci>n</m:ci>
	  </m:apply>
	</m:apply>
      </m:math>
      This estimate systematically underestimates the numbers of
      primes, except possibly for staggeringly large values of
      <m:math><m:ci>n</m:ci></m:math>. As a theorem it would state
      that in the limit of <m:math><m:ci>n</m:ci></m:math> going to
      infinity, the ratio of
      <m:math>
	<m:apply>
	  <m:ci type="fn">π</m:ci>
	  <m:ci>n</m:ci>
	</m:apply>
      </m:math>
      to 
      <m:math>
	<m:apply>
	  <m:divide/>
	  <m:ci>n</m:ci>
	  <m:apply>
	    <m:ln/>
	    <m:ci>n</m:ci>
	  </m:apply>
	</m:apply>
      </m:math>
      is unity. The theorem is of particular interest to
      mathematicians in that it follows from an as-yet unproven
      conjecture by Riemann on the distribution of zeros of the zeta
      function, a complicated topic which is not required for our
      simple analysis here.
    </para>

    <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="para4">
      An improved approximation is
      <m:math display="block">
	<m:apply>
	  <m:ci type="fn">Li</m:ci>
	  <m:ci>n</m:ci>
	</m:apply>
      </m:math>
      where <m:math><m:ci type="fn">Li</m:ci></m:math>, the <term xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">log integral
	function</term> is defined to be
      <m:math display="block">
	<m:apply>
	  <m:int/>
	  <m:bvar>
	    <m:ci>t</m:ci>
	  </m:bvar>
	  <m:lowlimit>
	    <m:cn>2</m:cn>
	  </m:lowlimit>
	  <m:uplimit>
	    <m:ci>n</m:ci>
	  </m:uplimit>
	  <m:apply>
	    <m:divide/>
	    <m:cn>1</m:cn>
	    <m:apply>
	      <m:ln/>
	      <m:ci>t</m:ci>
	    </m:apply>
	  </m:apply>
	</m:apply>
      </m:math> 
      This estimate is substantially better and systematically
      underestimates the number of primes (again until one gets to
      staggeringly large values). Notice that the first approximation
      results from considering the log term to be slowly varying and
      taking it out of the integral to get the (crude) estimate of
      <m:math>
	<m:apply>
	  <m:divide/>
	  <m:ci>n</m:ci>
	  <m:apply>
	    <m:ln/>
	    <m:ci>n</m:ci>
	  </m:apply>
	</m:apply>
      </m:math>.
      The log integral function diverges at 
      <m:math>
	<m:apply>
	  <m:eq/>
	  <m:ci>n</m:ci>
	  <m:cn>1</m:cn>
	</m:apply>
      </m:math>,
      but this has no relevance to its applications at large
      <m:math><m:ci>n</m:ci></m:math>.
    </para>
    <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="para5">
      Some large values (from <cite xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" src="#derbyshire">Derbyshire, p. 116</cite>).

      <table xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="largevals" frame="all">
	<tgroup xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" cols="3" colsep="1" rowsep="1">
	  <thead xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
	    <row xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
	      <entry xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/"><m:math><m:ci>n</m:ci></m:math></entry>
	      <entry xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/"><m:math><m:ci type="fn">π</m:ci></m:math></entry>
	      <entry xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/"><m:math>
		  <m:apply>
		    <m:minus/>
		    <m:ci type="fn">Li</m:ci>
		    <m:ci type="fn">π</m:ci>
		  </m:apply>
		</m:math></entry>
	    </row>
	  </thead>
	  <tbody xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
	    <row xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
	      <entry xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" align="right"><m:math>
		  <m:apply>
		    <m:power/>
		    <m:cn>10</m:cn>
		    <m:cn>8</m:cn>
		  </m:apply>
		</m:math></entry>
	      <entry xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" align="right">5,761,455</entry>
	      <entry xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" align="right">754</entry>
	    </row>
	    <row xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
	      <entry xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" align="right"><m:math>
		  <m:apply>
		    <m:power/>
		    <m:cn>10</m:cn>
		    <m:cn>9</m:cn>
		  </m:apply>
		</m:math></entry>
	      <entry xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" align="right">50,847,534</entry>
	      <entry xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" align="right">1,701</entry>
	    </row>
	    <row xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
	      <entry xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" align="right"><m:math>
		  <m:apply>
		    <m:power/>
		    <m:cn>10</m:cn>
		    <m:cn>10</m:cn>
		  </m:apply>
		</m:math></entry>
	      <entry xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" align="right">455,052,511</entry>
	      <entry xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" align="right">3,104</entry>
	    </row>
	    <row xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
	      <entry xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" align="right"><m:math>
		  <m:apply>
		    <m:power/>
		    <m:cn>10</m:cn>
		    <m:cn>11</m:cn>
		  </m:apply>
		</m:math></entry>
	      <entry xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" align="right">4,118,054,813</entry>
	      <entry xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" align="right">11,588</entry>
	    </row>
	    <row xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
	      <entry xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" align="right"><m:math>
		  <m:apply>
		    <m:power/>
		    <m:cn>10</m:cn>
		    <m:cn>12</m:cn>
		  </m:apply>
		</m:math></entry>
	      <entry xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" align="right">37,607,912,018</entry>
	      <entry xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" align="right">38,263</entry>
	    </row>
	    <row xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
	      <entry xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" align="right"><m:math>
		  <m:apply>
		    <m:power/>
		    <m:cn>10</m:cn>
		    <m:cn>13</m:cn>
		  </m:apply></m:math></entry>
	      <entry xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" align="right">346,065,536,839</entry>
	      <entry xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" align="right">108,971</entry>
	    </row>
	    <row xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
	      <entry xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" align="right"><m:math>
		  <m:apply>
		    <m:power/>
		    <m:cn>10</m:cn>
		    <m:cn>14</m:cn>
		  </m:apply>
		</m:math></entry>
	      <entry xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" align="right">3,204,941,750,802</entry>
	      <entry xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" align="right">314,890</entry>
	    </row>
	  </tbody>
	</tgroup>
      </table>
    </para>
    
    <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="para6">
      Anyone used to examining errors for trends would see that the
      steady increase in the difference 
      <m:math>
	<m:apply>
	  <m:minus/>
	  <m:ci type="fn">Li</m:ci>
	  <m:ci type="fn">π</m:ci>
	</m:apply>
      </m:math>
      by about a factor of 3 per decade in
      <m:math><m:ci>n</m:ci></m:math> suggests that there is a scaling
      correction that needs to be applied.
    </para>
    
    <section xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="calculating">
      <name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Calculating the primes</name>
      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="calc1">
	The method of choice to calculate a list of primes is to use
	the "sieve" of Eratosthenes.  Here one starts with a list the
	natural numbers. Then starting with 2, one removes every even
	number. The next number is 3, so now one removes every third
	number (half of these have already been removed by the 2).
	Here it is easiest to simply replace the values with zero,
	rather than literally removing the numbers. Now the next
	(non-zero) number is 5, and we set every fifth number to zero.
	Then 7 and then 11.  By eleven, the first 121 non-zero numbers
	will all be primes (<foreign xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">i.e.</foreign>, 11 squared).  The alternative of
	testing each successive number to see if a smaller prime
	divided it would be hopelessly inefficient.
      </para>

      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="calc2">
	Here is a simple MATLAB program (easily translated into the
	program of your choice):
      </para>
      <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="block">
	<![CDATA[
	1    %make-prime routine using sieve
	2    N = 100; %largest possible prime in list
	3    rpr=linspace(1,N,N); %starting list=all numbers up to N
	4    nextp = 2; %next prime to remove from list (this is ALSO its location)
	5    for j=2:N
	6    if (nextp*nextp)<N  %quit once all remaining nonzeros are primes
	7    for k=2:N %starts at 2 to preserve the prime itself
	8    if nextp*k <= N %don't exceed length of vector
	9    rpr(nextp*k) = 0; %the sieve!
	10   end
	11   end
	12   for n = 1:N
	13   if rpr(nextp+n) ~= 0  %run up list until first nonzero value
	14   nextp = rpr(nextp+n); %update nextp
	15   break %stop looking further, otherwise exit at N
	16   end
	17   end
	18   primes=[ ]; %start with empty vector
	19   for n=2:length(rpr) %now list the prime values only, excluding "1"
	20   if (rpr(n)~=0)
	21   primes=[primes,rpr(n)]; %add to existing vector of primes
	22   end
	23   end
	]]>
      </code>
      
      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="calc3">
	Here one simply chooses the value of
	<m:math><m:ci>N</m:ci></m:math>, and after executing the
	program, the vector "primes" will contain the list: <list xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="list1" type="inline"><item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">2</item><item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">3</item><item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">5</item><item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">7</item><item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">11</item><item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">13</item><item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">...</item><item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">97</item></list> (if <m:math><m:apply><m:eq/><m:ci>N</m:ci><m:cn>100</m:cn></m:apply></m:math>).
      </para>

      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="calc4">
	Note that the "sieve" itself never removes "1" and this number
	has all of the properties of a prime (not divisible by any
	other number besides 1 and itself).  But it has no use in the
	unique factoring of natural (whole) numbers into primes, and
	is so excluded.
      </para>

      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="calc5">
	This program has been checked against the list given in
	<cite xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Abramowitz and Stegun</cite> (the primes up to 99,991, which are
	roughly the first 10,000 primes).
      </para>
    </section>

    <section xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="derivation">
      <name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Derivation of a PNT</name>
      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="deriv1">
	The sieve suggests a simple way of estimating the distribution
	of primes. After any given prime, there will be a density of
	non-zero numbers remaining.  For example, after 2, half the
	remaining numbers will be nonzero. After the 3, one removes
	<m:math><m:mfrac><m:mn>1</m:mn><m:mn>3</m:mn></m:mfrac></m:math> but <m:math><m:mfrac><m:mn>1</m:mn><m:mn>2</m:mn></m:mfrac></m:math> are already gone, so we get 
	<m:math>
	  <m:apply>
	    <m:eq/>
	    <m:apply>
	      <m:minus/>
	      <m:apply><m:divide/><m:cn>1</m:cn><m:cn>2</m:cn></m:apply>
	      <m:apply><m:divide/><m:cn>1</m:cn><m:cn>6</m:cn></m:apply>
	    </m:apply>
          <m:apply><m:divide/><m:cn>1</m:cn><m:cn>3</m:cn></m:apply>
	  </m:apply>
	</m:math>
	left. Since there are an infinite number of numbers left, it
	is easier to think in terms of remaining blocks of numbers;
	after removing 2 and 3, we have blocks of 
	<m:math>
	  <m:apply>
	    <m:eq/>
	    <m:apply>
	      <m:times/>
	      <m:cn>2</m:cn>
	      <m:cn>3</m:cn>
	    </m:apply>
	    <m:cn>6</m:cn>
	  </m:apply>
	</m:math>,
	and in any arbitrary block of 6 consecutive numbers beyond the
	3, there will be exactly 2 non-zero numbers. If we go to 5,
	the blocks become
	<m:math>
	  <m:apply>
	    <m:eq/>
	    <m:apply>
	      <m:times/>
	      <m:cn>2</m:cn>
	      <m:cn>3</m:cn>
	      <m:cn>5</m:cn>
	    </m:apply>
	    <m:cn>30</m:cn>
	  </m:apply>
	</m:math>,
	and there will remain exactly 8 non-zero numbers in any block
	of 30 numbers beyond 5.  It is easy to verify that this
	density evolves quite systematically.  After each successive
	prime <m:math><m:ci>p</m:ci></m:math>, the average density per
	block drops by exactly a factor of
	<m:math display="block">
	  <m:apply>
	    <m:divide/>
	    <m:apply>
	      <m:minus/>
	      <m:ci>p</m:ci>
	      <m:cn>1</m:cn>
	    </m:apply>
	    <m:ci>p</m:ci>
	  </m:apply>
	</m:math>
      </para>

      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="deriv2">
	This density then corresponds to a mean distance between
	primes, since the next prime is chosen from the first non-zero
	number in the following block, and we can guess this distance
	from the mean density.  In particular, after each successive
	prime <m:math><m:ci>p</m:ci></m:math>, the density decreases
	by 
	<m:math>
	  <m:apply>
	    <m:divide/>
	    <m:apply>
	      <m:minus/>
	      <m:ci>p</m:ci>
	      <m:cn>1</m:cn>
	    </m:apply>
	    <m:ci>p</m:ci>
	  </m:apply>
	</m:math>
	and the mean distance correspondingly increases by
	<m:math>
	  <m:apply>
	    <m:divide/>
	    <m:ci>p</m:ci>
	    <m:apply>
	      <m:minus/>
	      <m:ci>p</m:ci>
	      <m:cn>1</m:cn>
	    </m:apply>
	  </m:apply>
	</m:math>.
	Let us call this mean distance after the
	<m:math><m:ci>k</m:ci></m:math>-th prime 
	<m:math>
	  <m:ci>
	    <m:msub>
	      <m:mi>Δ</m:mi>
	      <m:mi>k</m:mi>
	    </m:msub>
	  </m:ci>
	</m:math>,
	while the <m:math><m:ci>k</m:ci></m:math>-th prime itself we
	would call
	<m:math>
	  <m:ci>
	    <m:msub>
	      <m:mi>P</m:mi>
	      <m:mi>k</m:mi>
	    </m:msub>
	  </m:ci>
	</m:math>.
      </para>

      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="deriv3">
	It follows then that the next prime will be approximately
        <m:math display="block">
          <m:apply>
            <m:eq/>
            <m:ci>
              <m:msub>
                <m:mi>P</m:mi>
                <m:mrow>
                  <m:mi>k</m:mi>
                  <m:mo>+</m:mo>
                  <m:mn>1</m:mn>
                </m:mrow>
              </m:msub>
            </m:ci>
            <m:apply>
              <m:plus/>
              <m:ci>
                <m:msub>
                  <m:mi>P</m:mi>
                  <m:mi>k</m:mi>
                </m:msub>
              </m:ci>
              <m:ci>
                <m:msub>
                  <m:mi>Δ</m:mi>
                  <m:mi>k</m:mi>
                </m:msub>
              </m:ci>
            </m:apply>
          </m:apply>
        </m:math>
        but given this new prime, the mean step size increases to
        <m:math display="block">
          <m:apply>
            <m:eq/>
            <m:ci>
              <m:msub>
                <m:mi>Δ</m:mi>
                <m:mrow>
                  <m:mi>k</m:mi>
                  <m:mo>+</m:mo>
                  <m:mn>1</m:mn>
                </m:mrow>
              </m:msub>
            </m:ci>
            <m:apply>
              <m:times/>
              <m:ci>
                <m:msub>
                  <m:mi>Δ</m:mi>
                  <m:mi>k</m:mi>
                </m:msub>
              </m:ci>
              <m:apply>
                <m:divide/>
                <m:ci>
                  <m:msub>
                    <m:mi>P</m:mi>
                    <m:mrow>
                      <m:mi>k</m:mi>
                      <m:mo>+</m:mo>
                      <m:mn>1</m:mn>
                    </m:mrow>
                  </m:msub>
                </m:ci>
                <m:apply>
                  <m:minus/>
                  <m:ci>
                    <m:msub>
                      <m:mi>P</m:mi>
                      <m:mrow>
                        <m:mi>k</m:mi>
                        <m:mo>+</m:mo>
                        <m:mn>1</m:mn>
                      </m:mrow>
                    </m:msub>
                  </m:ci>
                  <m:cn>1</m:cn>
                </m:apply>
              </m:apply>
            </m:apply>
          </m:apply>
        </m:math>
      </para>
      
      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="deriv4">
        But now we are all done. If we chose the first prime
        (<m:math>
	  <m:ci>
	    <m:msub>
	      <m:mi>P</m:mi>
	      <m:mn>1</m:mn>
	    </m:msub>
	  </m:ci>
        </m:math>)
        and the distance to the next prime
        (<m:math>
	  <m:ci>
	    <m:msub>
	      <m:mi>Δ</m:mi>
	      <m:mn>1</m:mn>
	    </m:msub>
	  </m:ci>
        </m:math>),
        we can simply iterate these relationships indefinetely. Indeed, we know
        these values:
        <m:math display="block">
          <m:apply>
            <m:eq/>
            <m:ci>
              <m:msub>
                <m:mi>P</m:mi>
                <m:mn>1</m:mn>
              </m:msub>
            </m:ci>
            <m:cn>2</m:cn>
          </m:apply>
        </m:math>
        and
        <m:math display="block">
          <m:apply>
            <m:eq/>
            <m:ci>
              <m:msub>
                <m:mi>Δ</m:mi>
                <m:mn>1</m:mn>
              </m:msub>
            </m:ci>
            <m:cn>1</m:cn>
          </m:apply>
        </m:math>
      </para>

      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="deriv5">
        A MATLAB program would simply be
      </para>

      <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="block">
	<![CDATA[
	1    %recursion on steps to generate prime number counts
	2    N=9500;     %primes up to this number
	3    pr(1) = 2;  %initial prime
	4    del(1) = 1; %intial step
	5    for k= 1:N
	6    pr(k+1) = pr(k) + del(k);
	7    del(k+1) = del(k)*pr(k+1)/(pr(k+1)-1);
	8    end]]>
      </code>

      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="deriv6">
        We chose
        <m:math>
          <m:apply>
            <m:eq/>
            <m:ci>N</m:ci>
            <m:cn>9500</m:cn>
          </m:apply>
        </m:math>
        because this available on the tabulated lists, or if you created the
        list of primes, you should get
        <m:math>
          <m:apply>
            <m:eq/>
            <m:apply>
              <m:ci type="fn">primes</m:ci>
              <m:cn>9500</m:cn>
            </m:apply>
            <m:cn>98,947</m:cn>
          </m:apply>
        </m:math>.
        In contrast, the above program gives 102,014, which is too large by only about 3%.
      </para>

      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="deriv7">
        This result is rather astonishingly good given that the initial primes and steps between primes are anything but regular.
      </para>
    </section>

    <section xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="results">
      <name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Obtaining the PNT Results</name>
      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="results1">
        It is easy to rearrange the equations as difference equations and then
        write them as differential equations. First we write
        <m:math display="block">
          <m:apply>
            <m:eq/>
            <m:apply>
              <m:minus/>
              <m:ci>
                <m:msub>
                  <m:mi>P</m:mi>
                  <m:mrow>
                    <m:mi>k</m:mi>
                    <m:mo>+</m:mo>
                    <m:mn>1</m:mn>
                  </m:mrow>
                </m:msub>
              </m:ci>
              <m:ci>
                <m:msub>
                  <m:mi>P</m:mi>
                  <m:mi>k</m:mi>
                </m:msub>
              </m:ci>
            </m:apply>
            <m:ci>
              <m:msub>
                <m:mi>Δ</m:mi>
                <m:mi>k</m:mi>
              </m:msub>
            </m:ci>
          </m:apply>
        </m:math>
        and
        <m:math display="block">
          <m:apply>
            <m:eq/>
            <m:apply>
              <m:minus/>
              <m:ci>
                <m:msub>
                  <m:mi>Δ</m:mi>
                  <m:mrow>
                    <m:mi>k</m:mi>
                    <m:mo>+</m:mo>
                    <m:mn>1</m:mn>
                  </m:mrow>
                </m:msub>
              </m:ci>
              <m:ci>
                <m:msub>
                  <m:mi>Δ</m:mi>
                  <m:mi>k</m:mi>
                </m:msub>
              </m:ci>
            </m:apply>
            <m:apply>
              <m:times/>
              <m:ci>
                <m:msub>
                  <m:mi>Δ</m:mi>
                  <m:mi>k</m:mi>
                </m:msub>
              </m:ci>
              <m:apply>
                <m:divide/>
		<m:cn>1</m:cn>
		<m:apply>
		  <m:minus/>
		  <m:ci>
		    <m:msub>
		      <m:mi>P</m:mi>
		      <m:mrow>
			<m:mi>k</m:mi>
			<m:mo>+</m:mo>
			<m:mn>1</m:mn>
		      </m:mrow>
		    </m:msub>
		  </m:ci>
		  <m:cn>1</m:cn>
		</m:apply>
              </m:apply>
            </m:apply>
          </m:apply>
        </m:math>
      </para>

      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="results2">
        For large <m:math><m:ci>k</m:ci></m:math>, we can approximate these as
        <m:math display="block">
          <m:apply>
            <m:eq/>
            <m:apply>
              <m:diff/>
              <m:bvar>
                <m:ci>k</m:ci>
              </m:bvar>
              <m:apply>
                <m:ci type="fn">P</m:ci>
                <m:ci>k</m:ci>
              </m:apply>
            </m:apply>
            <m:apply>
              <m:ci type="fn">Δ</m:ci>
              <m:ci>k</m:ci>
            </m:apply>
          </m:apply>
        </m:math>
        and
        <m:math display="block">
          <m:apply>
            <m:eq/>
            <m:apply>
              <m:diff/>
              <m:bvar>
                <m:ci>k</m:ci>
              </m:bvar>
              <m:apply>
                <m:ci type="fn">Δ</m:ci>
                <m:ci>k</m:ci>
              </m:apply>
            </m:apply>
            <m:apply>
              <m:divide/>
              <m:apply>
                <m:ci type="fn">Δ</m:ci>
                <m:ci>k</m:ci>
              </m:apply>
              <m:apply>
                <m:ci type="fn">P</m:ci>
                <m:ci>k</m:ci>
              </m:apply>
            </m:apply>
          </m:apply>
        </m:math>
      </para>

      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="results3">
        One might worry about simplifying
        <m:math>
          <m:apply>
            <m:minus/>
            <m:ci>
              <m:msub>
                <m:mi>P</m:mi>
                <m:mrow>
                  <m:mi>k</m:mi>
                  <m:mo>+</m:mo>
                  <m:mn>1</m:mn>
                </m:mrow>
              </m:msub>
            </m:ci>
            <m:cn>1</m:cn>
          </m:apply>
        </m:math>
        to
        <m:math>
          <m:apply>
            <m:ci type="fn">P</m:ci>
            <m:ci>k</m:ci>
          </m:apply>
        </m:math>,
        but the "corrections" are tiny, and unimportant as we will show.
      </para>

      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="results4">
        The ratio is
        <m:math display="block">
          <m:apply>
            <m:eq/>
            <m:apply>
              <m:diff/>
              <m:bvar>
                <m:ci>Δ</m:ci>
              </m:bvar>
              <m:ci>P</m:ci>
            </m:apply>
            <m:ci>P</m:ci>
          </m:apply>
        </m:math>
        which integrates to give
        <m:math display="block">
          <m:apply>
            <m:eq/>
            <m:ci>P</m:ci>
            <m:apply>
              <m:times/>
              <m:ci>
                <m:msub>
                  <m:mi>P</m:mi>
                  <m:mn>1</m:mn>
                </m:msub>
              </m:ci>
              <m:apply>
                <m:exp/>
                <m:apply>
                  <m:minus/>
                  <m:ci>Δ</m:ci>
                  <m:ci>
                    <m:msub>
                      <m:mi>Δ</m:mi>
                      <m:mn>1</m:mn>
                    </m:msub>
                  </m:ci>
                </m:apply>
              </m:apply>
            </m:apply>
          </m:apply>
        </m:math>
        which then gives
        <m:math display="block">
          <m:apply>
            <m:eq/>
            <m:apply>
              <m:int/>
              <m:bvar><m:ci>k</m:ci></m:bvar>
              <m:lowlimit><m:cn>1</m:cn></m:lowlimit>
              <m:uplimit><m:ci>N</m:ci></m:uplimit>
              <m:cn/>
            </m:apply>
            <m:apply>
              <m:int/>
              <m:bvar><m:ci>P</m:ci></m:bvar>
              <m:lowlimit>
                <m:ci>
                  <m:msub>
                    <m:mi>P</m:mi>
                    <m:mn>1</m:mn>
                  </m:msub>
                </m:ci>
              </m:lowlimit>
              <m:uplimit><m:ci>P</m:ci></m:uplimit>
              <m:apply>
                <m:divide/>
                <m:cn>1</m:cn>
                <m:apply>
                  <m:plus/>
                  <m:ci>
                    <m:msub>
                      <m:mi>Δ</m:mi>
                      <m:mn>1</m:mn>
                    </m:msub>
                  </m:ci>
                  <m:apply>
                    <m:log/>
                    <m:apply>
                      <m:divide/>
                      <m:ci>P</m:ci>
                      <m:ci>
                        <m:msub>
                          <m:mi>P</m:mi>
                          <m:mn>1</m:mn>
                        </m:msub>
                      </m:ci>
                    </m:apply>
                  </m:apply>
                </m:apply>
              </m:apply>
            </m:apply>
          </m:apply>
        </m:math>
        Notice that this is in fact the log integral function of the improved PNT. However, because of the curious choice of notation, the natural symbols for <m:math><m:ci type="fn">π</m:ci></m:math> (here <m:math><m:ci>N</m:ci></m:math>) and <m:math><m:ci>n</m:ci></m:math> (here <m:math><m:ci type="fn">P</m:ci></m:math>) are reversed. 
      </para>

      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="results5">
        Notice that the
        <m:math>
          <m:ci>
            <m:msub>
              <m:mi>Δ</m:mi>
              <m:mn>1</m:mn>
            </m:msub>
          </m:ci>
        </m:math>
        in the denominator can be absorbed into the
        <m:math>
          <m:apply>
            <m:log/>
		<m:apply><m:divide/>
	    <m:ci>P</m:ci>
	    <m:ci>
	      <m:msub>
		<m:mi>P</m:mi>
		<m:mn>1</m:mn>
	      </m:msub>
	    </m:ci></m:apply>
          </m:apply>
        </m:math>
        and the rescaling <m:math><m:ci>P</m:ci></m:math> moves these terms to the limits on the integral. Effectively, this simply rescales
        <m:math>
          <m:apply>
            <m:ci type="fn">Li</m:ci>
            <m:ci>n</m:ci>
          </m:apply>
        </m:math>.
      </para>

      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="results6">
        Accordingly, we can chose a
        <m:math>
          <m:ci>
            <m:msub>
              <m:mi>Δ</m:mi>
              <m:mn>1</m:mn>
            </m:msub>
          </m:ci>
        </m:math>
        such that the curve is through the primes instead of being always off to one side. Such a rescaling makes perfect sense given that the PNT is just a fit to the primes and such a fit has to be global. Thus the fit is not obliged to either pass exactly through the prime 2 nor have the initial step size be exactly 1. Somehow the PNT derivation of
        <m:math>
          <m:apply>
            <m:ci type="fn">Li</m:ci>
            <m:ci>n</m:ci>
          </m:apply>
        </m:math>
        has effectively slipped in an implicit assumption that
        <m:math>
          <m:apply>
            <m:eq/>
            <m:ci>
              <m:msub>
                <m:mi>Δ</m:mi>
                <m:mn>1</m:mn>
              </m:msub>
            </m:ci>
            <m:apply>
              <m:log/>
              <m:ci>
                <m:msub>
                  <m:mi>P</m:mi>
                  <m:mn>1</m:mn>
                </m:msub>
              </m:ci>
            </m:apply>
          </m:apply>
        </m:math>
        (<foreign xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">e.g.</foreign>,
        <m:math>
          <m:apply>
	    <m:eq/>
	    <m:ci>
              <m:msub>
                <m:mi>Δ</m:mi>
                <m:mn>1</m:mn>
              </m:msub>
            </m:ci>
            <m:apply>
              <m:log/>
              <m:cn>2</m:cn>
            </m:apply>
            <m:cn type="real">0.6931</m:cn>
          </m:apply>
        </m:math>...).
      </para>

      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="results7">
        In fact, choosing
        <m:math display="block">
          <m:apply>
            <m:eq/>
            <m:ci>
              <m:msub>
                <m:mi>Δ</m:mi>
                <m:mn>1</m:mn>
              </m:msub>
            </m:ci>
            <m:cn type="real">0.625</m:cn>
          </m:apply>
        </m:math>
        provides a better fit that at large <m:math><m:ci>k</m:ci></m:math> gives an estimate for the value of the primes that oscillates about the correct values, being off a few percent to either side. This oscillation shows that there is little point in trying to do "better" (<foreign xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">e.g.</foreign>, trying to solve a more exact differential equation above; in fact we just iterated instead). A significant improvement could be gotten by letting
        <m:math>
          <m:ci>
            <m:msub>
              <m:mi>Δ</m:mi>
              <m:mn>1</m:mn>
            </m:msub>
          </m:ci>
        </m:math>
        be a weak function of <m:math><m:ci>k</m:ci></m:math>.
      </para>

      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="results8">
        Notice that we have not proven the PNT, we have just derived the same asymptotic functions cited in the proofs. One can create a number of interesting relationships using these approximate expressions and the PNT itself.
      </para>

      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="results9">
	For example, if we integrate the log integral function between
	two (large) successive primes, the result should be just unity
	(<foreign xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">i.e.</foreign>, one new prime).  Since the 
	<m:math>
	  <m:apply>
	    <m:log/>
	    <m:ci>
	      <m:msub>
		<m:mi>P</m:mi>
		<m:mi>k</m:mi>
	      </m:msub>
	    </m:ci>
	  </m:apply>
	</m:math>
	denominator will hardly change, the integral itself will be approximately
	<equation xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="logeq">
	  <m:math>
	    <m:apply>
	      <m:eq/>
	      <m:cn>1</m:cn>
	      <m:apply>
		<m:divide/>
		<m:apply>
		  <m:minus/>
		  <m:ci>
		    <m:msub>
		      <m:mi>P</m:mi>
		      <m:mrow>
			<m:mi>k</m:mi>
			<m:mo>+</m:mo>
			<m:mn>1</m:mn>
		      </m:mrow>
		    </m:msub>
		  </m:ci>
		  <m:ci>
		    <m:msub>
		      <m:mi>P</m:mi>
		      <m:mi>k</m:mi>
		    </m:msub>
		  </m:ci>
		</m:apply>
		<m:apply>
		  <m:log/>
		  <m:ci>
		    <m:msub>
		      <m:mi>P</m:mi>
		      <m:mi>k</m:mi>
		    </m:msub>
		  </m:ci>
		</m:apply>
	      </m:apply>
	    </m:apply>
	  </m:math>
	</equation>
	which can be rewritten as the recursion relation
	<equation xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="logeq2">
	  <m:math>
	    <m:apply>
	      <m:eq/>
	      <m:ci>
		<m:msub>
		  <m:mi>P</m:mi>
		  <m:mrow>
		    <m:mi>k</m:mi>
		    <m:mo>+</m:mo>
		    <m:mn>1</m:mn>
		  </m:mrow>
		</m:msub>
	      </m:ci>
	      <m:apply>
		<m:plus/>
		<m:ci>
		  <m:msub>
		    <m:mi>P</m:mi>
		    <m:mi>k</m:mi>
		  </m:msub>
		</m:ci>
		<m:apply>
		  <m:log/>
		  <m:ci>
		    <m:msub>
		      <m:mi>P</m:mi>
		      <m:mi>k</m:mi>
		    </m:msub>
		  </m:ci>
		</m:apply>
	      </m:apply>      
	    </m:apply>
	  </m:math>
	</equation>
	which must be one of the simplest possible recursion relations for primes.
	If we start it with the obviously simplest choice 
	<m:math>
	  <m:apply>
	    <m:eq/>
	    <m:ci>
	      <m:msub>
		<m:mi>P</m:mi>
		<m:mn>1</m:mn>
	      </m:msub>
	    </m:ci>
	    <m:cn>2</m:cn>
	  </m:apply>
	</m:math>, 
	we get <cnxn xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" target="fig1"/>.

	<figure xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="fig1">
		<media xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="application/postscript" src="logrec2.eps">
	    	  <media xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="image/png" src="logrec2.png"/>
 	    	</media>
		  <caption xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">The first thousand or so primes, plotting 
	    <m:math>
	      <m:apply>
		<m:ci>
		  <m:msub>
		    <m:mi>P</m:mi>
		    <m:mi>k</m:mi>
		  </m:msub>
		</m:ci>
	      </m:apply>
	    </m:math>
	    against <m:math><m:ci>k</m:ci></m:math>.  The uppermost (ragged) line are the actual primes, the dashed line just below it is 
	    <m:math>
	      <m:apply>
		<m:ci type="fn">Li</m:ci>
		<m:ci>k</m:ci>
	      </m:apply>
	    </m:math>, 
	    and the solid line is the simple recursion relation
	    <m:math>
	      <m:apply>
		<m:eq/>
		<m:ci>
		  <m:msub>
		    <m:mi>P</m:mi>
		    <m:mrow>
		      <m:mi>k</m:mi>
		      <m:mo>+</m:mo>
		      <m:mn>1</m:mn>
		    </m:mrow>
		  </m:msub>
		</m:ci>
		<m:apply>
		  <m:plus/>
		  <m:ci>
		    <m:msub>
		      <m:mi>P</m:mi>
		      <m:mi>k</m:mi>
		    </m:msub>
		  </m:ci>
		  <m:apply>
		    <m:log/>
		    <m:ci>
		      <m:msub>
			<m:mi>P</m:mi>
			<m:mi>k</m:mi>
		      </m:msub>
		    </m:ci>
		  </m:apply>
		</m:apply>
	      </m:apply>
	    </m:math>
	    starting with 

	    <m:math>
	      <m:apply>
		<m:eq/>
		<m:ci>
		  <m:msub>
		    <m:mi>P</m:mi>
		    <m:mn>1</m:mn>
		  </m:msub>
		</m:ci>
		<m:cn>2</m:cn>
	      </m:apply>
	    </m:math>.
	  </caption>
	</figure>

	Another step is to replace 
	<m:math>
	  <m:apply>
	    <m:minus/>
	    <m:ci>
	      <m:msub>
		<m:mi>P</m:mi>
		<m:mrow>
		  <m:mi>k</m:mi>
		  <m:mo>+</m:mo>
		  <m:mn>1</m:mn>
		</m:mrow>
	      </m:msub>
	    </m:ci>
	    <m:ci>
	      <m:msub>
		<m:mi>P</m:mi>
		<m:mi>k</m:mi>
	      </m:msub>
	    </m:ci>
	  </m:apply>
	</m:math>
	with 
	<m:math>
	  <m:msub>
	    <m:mi>Δ</m:mi>
	    <m:mi>k</m:mi>
	  </m:msub>
	</m:math>, 
	namely the mean distance between primes.  This gives us
	
	<m:math display="block">
	  <m:apply>
	    <m:eq/>
	    <m:apply>
	      <m:limit/>
	      <m:bvar><m:ci>k</m:ci></m:bvar>
	      <m:condition>
		<m:apply>
		  <m:tendsto/>
		  <m:ci>k</m:ci>
		  <m:infinity/>
		</m:apply>
	      </m:condition>
	      <m:apply>
		<m:times/>
		<m:apply>
		  <m:log/>
		  <m:ci>
		    <m:msub>
		      <m:mi>P</m:mi>
		      <m:mi>k</m:mi>
		    </m:msub>
		  </m:ci>
		</m:apply>
		<m:apply>
		  <m:minus/>
		  <m:cn>1</m:cn>
		  <m:apply>
		    <m:divide/>
		    <m:cn>1</m:cn>
		    <m:ci>
		      <m:msub>
			<m:mi>P</m:mi>
			<m:mn>1</m:mn>
		      </m:msub>
		    </m:ci>
		  </m:apply>
		</m:apply>
		<m:apply>
		  <m:minus/>
		  <m:cn>1</m:cn>
		  <m:apply>
		    <m:divide/>
		    <m:cn>1</m:cn>
		    <m:ci>
		      <m:msub>
			<m:mi>P</m:mi>
			<m:mn>2</m:mn>
		      </m:msub>
		    </m:ci>
		  </m:apply>
		</m:apply>
		<m:ci>...</m:ci>
		<m:apply>
		  <m:minus/>
		  <m:cn>1</m:cn>
		  <m:apply>
		    <m:divide/>
		    <m:cn>1</m:cn>
		    <m:ci>
		      <m:msub>
			<m:mi>P</m:mi>
			<m:mi>k</m:mi>
		      </m:msub>
		    </m:ci>
		  </m:apply>
		</m:apply>
	      </m:apply>
	    </m:apply>
	    <m:ci>const</m:ci>
	  </m:apply>
	</m:math>

	and the result for the first million primes is plotted in <cnxn xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" target="fig2"/>.
	The constant is actually 
	<m:math>
	  <m:apply>
	    <m:exp/>
		<m:apply><m:minus/>
		    <m:ci>γ</m:ci>
		</m:apply>
	  </m:apply>
	</m:math>
	where gamma is Euler's constant, 0.5772157... and the exponential is 0.56145946... and we can see the convergence to this value.  This result was derived in 1874 and is known as <cite xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Merten's theorem</cite> (but the proof was based on Riemann's
	(1859) paper and not on a causal idea of a "mean distance between primes").
	The above product form is a favorite of number theorists because its inverse
	is a special case of the zeta function, namely the value of that function at
	unity, which happens to be an infinity that just cancels the infinity in the
	limit of 
	<m:math>
	  <m:apply>
	    <m:ci>
	      <m:msub>
		<m:mi>P</m:mi>
		<m:mi>k</m:mi>
	      </m:msub>
	    </m:ci>
	  </m:apply>
	</m:math>
	(in the sense of the above limit).

	<figure xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="fig2">
	<media xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="application/postscript" src="merten.eps">
	    	  <media xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="image/png" src="merten.png"/>
 	</media>
	  <caption xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Plot of 
	    <m:math>
	      <m:apply>
		<m:log/>
		<m:ci>
		  <m:msub>
		    <m:mi>P</m:mi>
		    <m:mi>k</m:mi>
		  </m:msub>
		</m:ci>
	      </m:apply>
	    </m:math>
	    divided by 
	    <m:math><m:msub>
	      <m:mi>Δ</m:mi>
	      <m:mi>k</m:mi></m:msub>
	    </m:math>.
	    If we were to plot this function on ordinary linear scale, it would look like a step function starting at 0.346 and almost immediately jumping to what looks like the asymptotic value, and then being constant out to a value of almost 100,000. So we have expanded the vertical scale to show the trend and plotted the horizontal scale as a log plot to show how the "fluctuations" die off with increasing size of the primes.  Here a linear plot suppresses that trend because almost all of the points to the right of the origin would now correspond to "large" primes.</caption>
	</figure>

	In Merten's theorem we have used the "natural" definition for
	<m:math>
	  <m:msub>
	    <m:mi>Δ</m:mi>
	    <m:mn>1</m:mn>
	  </m:msub>
	</m:math>
	of <m:math><m:mfrac><m:mn>1</m:mn><m:mn>2</m:mn></m:mfrac></m:math>, whereas when we used it in the recursion relation for primes we instead defined 
	<m:math>
	  <m:apply>
	    <m:eq/>
	    <m:msub>
	      <m:mi>Δ</m:mi>
	      <m:mn>1</m:mn>
	    </m:msub>
	    <m:cn>1</m:cn>
	  </m:apply>
	</m:math>, 
	since that was the actual spacing between the starting prime 2 and the next prime, 3. Alternatively, to agree with the log integral expression we would have
	had to define 
	<m:math>
	  <m:apply>
	    <m:eq/>
	    <m:msub>
	      <m:mi>Δ</m:mi>
	      <m:mn>1</m:mn>
	    </m:msub>
	    <m:apply>
	      <m:log/>
	      <m:cn>2</m:cn>
	    </m:apply>
	  </m:apply>
	</m:math>.
	In recursion relations there is often such a freedom of choice, as well a "natural" choice.
      </para>
    </section>
  </content>
<bib:file>
  <bib:entry id="derbyshire">
    <bib:book>
      <bib:author>Derbyshire, J.</bib:author>
      <bib:title>Prime Obsession</bib:title>
      <bib:publisher>Joseph Henry Press</bib:publisher>
      <bib:year>2003</bib:year>
    </bib:book>
  </bib:entry>
</bib:file>
</document>
