Hi everyone, I couldn't find a way to solve ps1. I've just finished lecture 1 and 2, and I think ps1 due for lecture3. But I'm not sure if the knowledge I have so far is enough to solve ps1. By the way I'm very new with the programming. Do you think, just knowing while and if statement are enough to solve this question. Thanks for your help...
With while and if statements you could solve all the problems that you can find an algorithm for them (see lecture3) ! Here's the idea, with a loop you can count the primes till the 1000th, and with another loop inside (for incrementing divisors) and with some tests you can check if a candidate is a prime or not. Well I just want to say that your knowledge is largely enough to resolve this problem, good luck ^_^
another hint: there is no need to test each divisor, the already known list of prime numbers is just enough
Thanks for your advise, morphy and anpenik. I try my best to solve it, it just feels too complicated. Do you think, I should first watch lecture 3?
lecture 3 is about developing good style and writing proper codes, you can watch it may be it'll help you. but don't jump to the 4th until you feel at ease with the basics :)
Thanks for your comment morphy. I did watch the lecture three and it really helped me out, but I'll listen your advise and until I feel comfortable with the exercise, I won't start to the lecture 4.
Join our real-time social learning platform and learn together with your friends!