If I interpret this correctly [...] the theorum provides a way of calculating a set of bounds within which the next prime will be located which reduces the search area considerably

Your conclusion is dead wrong but I don't think it is due to a problem of interpretation. (:

You could use the theorem to restrict the search area for the next prime but it would be much more useful to use other techniques to restrict the search area:

  1. Assume the next prime after some prime (P) is larger than P. In fact, you should probably start looking at P+2 unless P is 2 (in which case you simply return 3 without performing any calculations).
  2. Assume the next prime after P doesn't have a prime between P and it. That is, start looking close to P and stop looking when you find a prime.

That is, if you used the theorem to find the lower bound of where to search, it would return a value quite a bit below P so using the (obvious) lower limit of P will be a much better choice. And finding an upper bound of where to search is of no use since it will be too high to make sense to start looking there and starting on the low end means we know we will find a prime (the one we are looking for) before we get to the upper bound (or else we'd have proved the theorem incorrect).

                - tye

In reply to Re^2: Finding the next larger prime. (conclusions) by tye
in thread Finding the next larger prime. by BrowserUk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.