I just completed problem set 1. I was wondering if anyone would mind taking a look at my code for question 2 and let me know if I missed anything. So far, it's worked perfectly, but I'd like to have a second (or third or fourth) set of eyeballs look it over. http://dpaste.com/549397/
Hoot! You just asked your first question! Hang tight while I find people to answer it for you. You can thank people who give you good answers by clicking the 'Good Answer' button on the right!
Great program! Seems to work really well, I particularly love how it asks if you want to run the program again. My only concern is that when I was struggling with this, people told me that you are supposed to add the numbers up to the n, as in all the numbers but not the final. If you wanted to push the defensive programming idea a bit further, you could stop me from inputting floats, when I put in a float it gave me an answer. That's really all I can think of...
Thanks for the input! The point about inputting floats was great. I've modified the program to allow only integers greater than 0. I'm not sure about the excluding n, though. The assignment asks to sum the logs of n number of primes. Why would it do that, then have you sum n - 1 logs of the primes? Am I missing something?
Wait, nevermind. I realize I was reading this wrong. It seems to be asking you to find all the primes that are less than the number n, rather than n primes.
Join our real-time social learning platform and learn together with your friends!