1000th prime

Hello! i am trying to print a 1000th prime number.

Page 1 of 1

2 Replies - 1893 Views - Last Post: 15 June 2010 - 11:40 AM Rate Topic: -----

#1 Guest_lakka*


1000th prime

Posted 14 June 2010 - 08:27 PM

Its a beginner's level program so i cant use functions or strings or any high level stuff just basic iterations and condition statements! I tried a lot but there is no use. Please check and verify and send the correct program. THANKING YOU.

n=raw_input('Enter the value: ')

if (a%b==0):
if (c==2):

Is This A Good Question/Topic? 0

Replies To: 1000th prime

#2 cnampheonix   User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 63
  • Joined: 03-December 09

Re: 1000th prime

Posted 14 June 2010 - 09:05 PM

Please try to use the "[c o d e] [/c o d e]" it really helps us to read your code better.
It would also help to label your variables with better meaning.
I understand that you are trying to find primes.
There is another post up with the same topic if you want to look that over. In any case, I'm not following your thought process with your code.
Could you explain what your trying to do?

What is your

suppose to do?
And please explain all your increments.

This post has been edited by cnampheonix: 14 June 2010 - 09:06 PM

Was This Post Helpful? 0
  • +
  • -

#3 SpeedisaVirus   User is offline

  • Baller

Reputation: 115
  • View blog
  • Posts: 855
  • Joined: 06-October 08

Re: 1000th prime

Posted 15 June 2010 - 11:40 AM

It will also help to explain what is wrong with the code. From what I can see you are taking a naive approach. If you want to impress your instructor a little bit you might want to try and implement a sieve instead.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1