Problem 001
Forum rules
As your posts will be visible to the general public you are requested to be thoughtful in not posting anything that might explicitly give away how to solve a particular problem.
This forum is NOT meant to discuss solution methods for a problem.
See also the topics:
Don't post any spoilers
Comments, questions and clarifications about PE problems.
As your posts will be visible to the general public you are requested to be thoughtful in not posting anything that might explicitly give away how to solve a particular problem.
This forum is NOT meant to discuss solution methods for a problem.
In particular don't post any code fragments or results.
Don't start begging others to give partial answers to problems
Don't ask for hints how to solve a problem
Don't start a new topic for a problem if there already exists one
Don't start begging others to give partial answers to problems
Don't ask for hints how to solve a problem
Don't start a new topic for a problem if there already exists one
See also the topics:
Don't post any spoilers
Comments, questions and clarifications about PE problems.
-
blucosmon
- Posts: 2
- Joined: Wed Jun 08, 2011 1:45 am
Re: Problem 001
As I understand the question, the natural numbers unique to 3 and 5 below and not inclusive of 1000 are to be added together. If I run both sets of numbers - for 3 and 5, and eliminate the duplicates, can I expect to get the answer?
-
TripleM
- Posts: 384
- Joined: Fri Sep 12, 2008 3:31 am
-
blucosmon
- Posts: 2
- Joined: Wed Jun 08, 2011 1:45 am
Re: Problem 001
TripleM wrote:Why don't you try it and see?
I did attempt to solve the problem per my understanding of the problem, but again I was wrong! I think after six of seven tries I'm just not going to get it based on my understanding. Oh well.
- Molx
- Posts: 3
- Joined: Tue Jun 07, 2011 6:44 pm
- Location: Brazil
- Contact:
Re: Problem 001
Don't give up! It is good sometimes to take a break, but come back to the problem later and you will probably see what was wrong and think "How could I not see that?" Happens all the time. And it feels so good when you get that right answer based on your thinking =)blucosmon wrote:TripleM wrote:Why don't you try it and see?
I did attempt to solve the problem per my understanding of the problem, but again I was wrong! I think after six of seven tries I'm just not going to get it based on my understanding. Oh well.

-
jshowalter
- Posts: 2
- Joined: Sun Jun 12, 2011 4:17 am
Re: Problem 001
The problem statement is ambiguous.
Either you want the sum of every number that is divisible by 3 or 5, summing once per divisibility; or you want the sum of every number that is divisible by 3 or 5, but you don't want to add that number to the sum twice.
If you want the sum once, then 15 should be added to the sum once; else it should be added to the sum twice. It is not clear from the instructions which you want.
The problem statement needs to be clear. We're not testing programmers' ability to infer requirements from poorly written requirements, we're testing programmers' ability to follow well-written requirements.
Either you want the sum of every number that is divisible by 3 or 5, summing once per divisibility; or you want the sum of every number that is divisible by 3 or 5, but you don't want to add that number to the sum twice.
If you want the sum once, then 15 should be added to the sum once; else it should be added to the sum twice. It is not clear from the instructions which you want.
The problem statement needs to be clear. We're not testing programmers' ability to infer requirements from poorly written requirements, we're testing programmers' ability to follow well-written requirements.
-
TripleM
- Posts: 384
- Joined: Fri Sep 12, 2008 3:31 am
Re: Problem 001
A knowledge of English is required, and the problem statement is not ambiguous. The alternative you have proposed is simply incorrect grammatically; if that were the question you would be asked to add the multiples of 3 AND the multiples of 5.
-
jshowalter
- Posts: 2
- Joined: Sun Jun 12, 2011 4:17 am
Re: Problem 001
Er, no.TripleM wrote:A knowledge of English is required, and the problem statement is not ambiguous. The alternative you have proposed is simply incorrect grammatically; if that were the question you would be asked to add the multiples of 3 AND the multiples of 5.
15 is divisible by 3, so it meets the criterion of being a multiple of 3, and should be added to the sum.
15 is also divisible by 5, so it meets the criterion of being a multiple of 5, and should be added to the sum.
Perhaps you meant to specify exclusive-or.
I got the solution you wanted, but did it by writing the code both ways and plugging in first one answer and then the other until it said congratulations.
-
TripleM
- Posts: 384
- Joined: Fri Sep 12, 2008 3:31 am
Re: Problem 001
No, I didn't mean exclusive or, I meant exactly what I said.
Like I said, you aren't told to add together the multiples of 5 and the multiples of 3, considering them as two separate lists; there is no way to ask that without using the word 'and'. You're asked to add numbers that satisfy a condition; the condition being that they are a multiple of 3 or 5.
There really isn't anything else I can say other than the fact I am 100% confident that question is entirely well defined (and that it won't be changed).
[edit] How about this for a simply analogy..
10 cars drive past you; 2 are red, 2 are green, 2 are blue, and 4 have both red and green on them.
"How many cars had red or green on them?"
"12."
"That can't possibly be right, there were only 10 cars in the first place.."
Like I said, you aren't told to add together the multiples of 5 and the multiples of 3, considering them as two separate lists; there is no way to ask that without using the word 'and'. You're asked to add numbers that satisfy a condition; the condition being that they are a multiple of 3 or 5.
There really isn't anything else I can say other than the fact I am 100% confident that question is entirely well defined (and that it won't be changed).
[edit] How about this for a simply analogy..
10 cars drive past you; 2 are red, 2 are green, 2 are blue, and 4 have both red and green on them.
"How many cars had red or green on them?"
"12."
"That can't possibly be right, there were only 10 cars in the first place.."
-
Spectravideo
- Posts: 2
- Joined: Sun Jun 12, 2011 5:38 am
Re: Problem 001
Oh the power of wording 
You're asked to add numbers that satisfy a condition; the condition being that they are a multiple of 3 or 5.
-
JamesPr
- Posts: 1
- Joined: Sun Jun 26, 2011 7:46 pm
Problem 001
Hello,
I am trying to code this problem in Python.
I'm not sure why my code isn't working. Right now I am printing every iteration of this code. The adding must be incorrect. Could someone please point me to what is wrong? Thanks!
*Problem 1 Code*
I am trying to code this problem in Python.
I'm not sure why my code isn't working. Right now I am printing every iteration of this code. The adding must be incorrect. Could someone please point me to what is wrong? Thanks!
*Problem 1 Code*
Expand
- hk
- Administrator
- Posts: 12832
- Joined: Sun Mar 26, 2006 10:34 am
- Location: Haren, Netherlands
Re: Problem 001
You're probably new here, but dit you read everything in that red box above this page?
There existed already a topic for this problem and I merged it with that topic.
Reading everything written in this topic will make clear what you are doing wrong.
(it has to do with the number 15 and numbers like that.)
There existed already a topic for this problem and I merged it with that topic.
Reading everything written in this topic will make clear what you are doing wrong.
(it has to do with the number 15 and numbers like that.)

War ruins the life and health of untold numbers of innocent children.
-
Howdy_McGee
- Posts: 1
- Joined: Sun Jul 10, 2011 5:56 am
Problem 001
Whelp apparently i'm stumped pretty early... I don't quite understand, are 5 and 3 supposed to not go over 1000? :S not sure if this is spoilers but meaning 995 would be the limit of 5?
- jake223
- Posts: 61
- Joined: Mon Apr 25, 2011 5:15 am
- Location: USA
- Contact:
Re: Problem 001
yes, that is all correct, but you don't need to know that 995 is the upper limit <= to solve it. think <. keep trying. 

-
rjashton
- Posts: 2
- Joined: Mon Jul 18, 2011 3:47 pm
Re: Problem 001
So I managed to solve this one fairly quickly but I was wondering: if I can't post my code here where can I post it?
-
Hibernatus34
- Posts: 31
- Joined: Mon May 16, 2011 7:03 am
Re: Problem 001
Do you think your code would interest any of us ?rjashton wrote:So I managed to solve this one fairly quickly but I was wondering: if I can't post my code here where can I post it?
Does it use a revolutionary formula ? (you can't even call it an algorithm for this problem)
If not, why do you want to post your code somewhere ?
Have you read the forum and the PDF ? Haven't you found the exact same solution as yours ?
Joined PE in May 2011-
Plebian
- Posts: 2
- Joined: Mon Jul 18, 2011 4:54 pm
Re: Problem 001
Just ran into this website, have only been coding for a couple of days. Trying to pick up Python. Currently have a list that writes itself, and sums the totals. I just need to figure out a way to exclude the multiple numbers from my sum.
(ex: 15, 30, 45)
I've noticed posting code is forbidden, how are we supposed to go about getting help with our code?
(ex: 15, 30, 45)
I've noticed posting code is forbidden, how are we supposed to go about getting help with our code?
-
Hibernatus34
- Posts: 31
- Joined: Mon May 16, 2011 7:03 am
Re: Problem 001
You are challenged to solve the problems on your own.Plebian wrote:I've noticed posting code is forbidden, how are we supposed to go about getting help with our code?
Once you have solved a problem you gain access to a forum and a PDF, so you can learn better solutions.
Joined PE in May 2011- hk
- Administrator
- Posts: 12832
- Joined: Sun Mar 26, 2006 10:34 am
- Location: Haren, Netherlands
Re: Problem 001
Do you notice a property that those multiple numbers have in common? (This has nothing to do with coding, but with math)Plebian wrote:Just ran into this website, have only been coding for a couple of days. Trying to pick up Python. Currently have a list that writes itself, and sums the totals. I just need to figure out a way to exclude the multiple numbers from my sum.
(ex: 15, 30, 45)
I've noticed posting code is forbidden, how are we supposed to go about getting help with our code?

War ruins the life and health of untold numbers of innocent children.
-
Plebian
- Posts: 2
- Joined: Mon Jul 18, 2011 4:54 pm
Re: Problem 001
Well, I notice they're multiple of 3 and 5. I think my problem is with my Counter, I think it's adding the last result past 1000. I'll try to set up a check and it should fix it.
Edit: Yup. That's exactly what it was. Had to reorder my Check so it came earlier in my code.
Edit2: Forum thread's closed but.. wow. The other Python solutions are much more complex and shorter than mine.
Edit: Yup. That's exactly what it was. Had to reorder my Check so it came earlier in my code.
Edit2: Forum thread's closed but.. wow. The other Python solutions are much more complex and shorter than mine.