Primes

Given an integer N ≤ 100, output the first N primes, one per line.

Sample Input

4

Sample Output

2
3
5
7

All Submissions
Best Solutions


Point Value: 3
Time Limit: 1.00s
Memory Limit: 16M
Added: Sep 23, 2008

Problem Types: [Show]

Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

Comments (Search)

My 5th asnwer is coming out as incorrect, but Im not sure why thats wrong and the other results are correct.

You are missing some primes.

Also, I can't say I approve of your solution method...

My code isnt working. Please help

Traceback (most recent call last): 
File "a.out", line 5, in <module>
while n >=2 and start <=a :
TypeError: unorderable types: int() <= str()

what does that mean?

Are you running your code before you submit? You took in N as a string, and then tried to compare it to an int. Does that make sense?