Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

KevPop Group Title

New at learning programming. Using the fall 2008 course ware and on second lecture. Finished and now attempting problem 1 to compute and print the 1000th prime number. I read corresponding materials, but feel like a deer in head lights, because i do not even know how to move ahead. maybe someone could lend some advice. lecture one problem was much easier than this exercise!

  • one year ago
  • one year ago

  • This Question is Open
  1. bwCA Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    on a piece of paper, write down in words the things/steps that need to be taken to solve the problem. Try to break down the solution into discrete chunks, write a piece of code for each chunk, put all the chunks together. while coding and debugging, frequently refer to and update the steps you initially wrote down on paper. just go ahead and start coding - if you get stuck, use print statements to find out what is really happening instead of what you think is happening. use a code pasting site to post code that you have questions about - it makes it easier for everyone to refer to it (don't forget to enable syntax highlighting) http://dpaste.com http://pastebin.com (there are others) http://www.pythontutor.com/ is a good tool to help debug - but print statement rule.

    • one year ago
  2. Zico13 Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    @KevPop: For this program, first write the code for checking whether a given number is prime (think about the definition of prime numbers). Then introduce a counting variable to count the number of prime numbers generated, and keep incrementing it every time you find a prime number. Put this test in a loop which will terminate when the 1000th prime number is reached.

    • one year ago
  3. Sparky1972 Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    I have been struggling with this exercise also. Attached is the link to code I created - however it is not giving the correct answer - I think my for loop is messed up - Help appreciated. http://pastebin.com/njFCyy6q Thanks Guys.

    • one year ago
  4. bwCA Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    @Sparky1972 you might want to start a new post so others will see it have you tried print statements? http://pastebin.com/kk5PPRJe (ctrl-c will stop that) what is the definition of a prime number? does your code do that?

    • one year ago
    • Attachments:

See more questions >>>

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.