Python Code to Find x Prime Numbers w/ For Loop?
<p>I am trying to put together a simple program which could work out n prime numbers. I would like to do this by using a nested for loop, where one would go through the numbers, and another would divide that number by all of the numbers up to it to see if it would be divisible by anything.</p>

<p>The problem I am having is that in the main for loop, I need to start it at 2, seeing as 1 would mess up the system and I don't want it to be considered a prime. For the loop to have a starting number however, it also needs an ending number which is difficult in this instance as it is hard to generate the largest prime that will be needed prior to the loop working.</p>

<p>Here's the program that I am using right now. Where I have marked X is where I need to somehow put an ending number for the For Loop. I guess it would be much simpler if I let the For Loop be completely open, and simply take out anything that '1' would produce in the loop itself, but this feels like cheating and I want to do it right.</p>

<pre><code>check = 0
limit = int(input("Enter the amount of Prime Numbers"))
for i in range(2,X):
    check = 0
    if i &gt; 1:
        for j in range(2,i):
            if (i % j) == 0:
                check = 1
    if check == 0:
        print (i)
</code></pre>

<p>Thanks for your help!</p>