Discuss Project Euler Problem 1 in the Python Programming forum on Dev Shed. Project Euler Problem 1 Python Programming forum discussing coding techniques, tips and tricks, and Zope related information. Python was designed from the ground up to be a completely object-oriented programming language.
Receive the tools necessary to be the rock star of your field. Our 12-month program teaches you the evolving world of multi-channel marketing as well as the complex issues and opportunities found in the industry.
ASP Free and Iron Speed Designer are giving away $5,500+ in FREE licenses. Iron Speed's RAD CASE toolset can save up to 80% of your coding time. One free license per week, one perpetual license per month! Download and Activate to enter!
Web development can be a daunting task, even for specialists. There is a lot of information to absorb and a lot of technologies to learn in order to manage a superior website. When trying to learn the ropes, developers need a reliable source to introduce new ideas that can be easily implemented. When working on large projects, even web veterans may run into a technology or an aspect of a technology that they are unfamiliar with.
Posts: 61
Time spent in forums: 1 Day 1 h 6 m 11 sec
Reputation Power: 1
Project Euler Problem 1
Yes, yes...I know, problem 1 easy easy. Etc.
Seriously though, I have no idea what I have gotten wrong.
It says sum of multiples of 3 OR 5 below 1000. I chose 3, I wrote a program that took the input of the user, 3, and I used a while loop (while y<=999) and appended the values within the list. This is what I get:
I then use print sum(x) to add them all up and I get 166833
The answer is incorrect. Same thing for 5's. Answer is also incorrect if I had the sums of the 3's and the 5's...
Starting to think I'm confused about what the question is asking. If you need me to post the code then I shall, also I'm not looking for the answer to the problem just a hint that can point me in the right direction if need be. Thank you.
Posts: 10,754
Time spent in forums: 5 Months 10 h 38 m 33 sec
Reputation Power: 7951
Yes, you're confused about the question.
You are to look at all numbers between 1 and 1000 and sum up the ones that are divisible by 3 as well as the ones divisible by 5. Thus the sequence begins 3, 5, 6, 9, 10...
Note how you can't just add up the totals from the divisible-by-three and divisible-by-five sequences because they'll have some numbers in common (15, 30, 45...) and you'd be incorrectly counting them twice.
Posts: 61
Time spent in forums: 1 Day 1 h 6 m 11 sec
Reputation Power: 1
Quote:
Originally Posted by requinix
Yes, you're confused about the question.
You are to look at all numbers between 1 and 1000 and sum up the ones that are divisible by 3 as well as the ones divisible by 5. Thus the sequence begins 3, 5, 6, 9, 10...
Note how you can't just add up the totals from the divisible-by-three and divisible-by-five sequences because they'll have some numbers in common (15, 30, 45...) and you'd be incorrectly counting them twice.