Javascript Finding Prime Numbers
<p>I am writing a little script to find and print out all the prime numbers from X thru Y.  Here is what I have written:</p>

<pre><code>var numX = prompt('Enter a number greater than 0:','');
var numY = prompt('Enter a number greater than ' + numX + ':','');

while (numX &lt;= numY) {
    if (numX == 1 || numX == 2 || numX == 3) {
    document.write(numX + '&lt;/br&gt;');
    } else if (numX % 2 === 0 || numX % 3 === 0 || numX % 5 === 0 || numX % 7 === 0){
    document.write();
    } else {
    document.write(numX + '&lt;/br&gt;');
    }
    numX++;
};
</code></pre>

<p>Now, this works just fine so long as the first number is 1.  If, however, the first number is anything greater than 1 it does not print out anything.  I am not sure if this is the right forum for this question (perhaps a math forum?), but I thought I would ask here on the off chance someone could help me out.  I also know that a sieve is the better way to go about this, but I wanted to try and figure this out as a while loop first.  Any and all help is appreciated!</p>
