Page 5 of 8

Re: Problem 001

Posted: Thu Jun 09, 2011 11:52 am
by blucosmon
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?

Re: Problem 001

Posted: Thu Jun 09, 2011 11:55 am
by TripleM
Why don't you try it and see? :)

Re: Problem 001

Posted: Fri Jun 10, 2011 6:06 pm
by blucosmon
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.

Re: Problem 001

Posted: Fri Jun 10, 2011 10:51 pm
by Molx
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.
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 =)

Re: Problem 001

Posted: Sun Jun 12, 2011 4:22 am
by jshowalter
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.

Re: Problem 001

Posted: Sun Jun 12, 2011 5:03 am
by TripleM
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.

Re: Problem 001

Posted: Sun Jun 12, 2011 6:35 am
by jshowalter
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.
Er, no.

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.

Re: Problem 001

Posted: Sun Jun 12, 2011 6:50 am
by TripleM
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.."

Re: Problem 001

Posted: Tue Jun 14, 2011 11:25 pm
by Spectravideo
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.

Problem 001

Posted: Sun Jun 26, 2011 7:53 pm
by JamesPr
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*
Expand
snipped by hk

Re: Problem 001

Posted: Sun Jun 26, 2011 8:43 pm
by hk
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.)

Problem 001

Posted: Sun Jul 10, 2011 5:59 am
by Howdy_McGee
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?

Re: Problem 001

Posted: Sun Jul 10, 2011 3:37 pm
by jake223
yes, that is all correct, but you don't need to know that 995 is the upper limit <= to solve it. think <. keep trying. :)

Re: Problem 001

Posted: Mon Jul 18, 2011 3:50 pm
by rjashton
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?

Re: Problem 001

Posted: Mon Jul 18, 2011 4:50 pm
by Hibernatus34
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?
Do you think your code would interest any of us ?
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 ?

Re: Problem 001

Posted: Mon Jul 18, 2011 8:18 pm
by Plebian
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?

Re: Problem 001

Posted: Mon Jul 18, 2011 8:35 pm
by Hibernatus34
Plebian wrote:I've noticed posting code is forbidden, how are we supposed to go about getting help with our code?
You are challenged to solve the problems on your own.
Once you have solved a problem you gain access to a forum and a PDF, so you can learn better solutions.

Re: Problem 001

Posted: Mon Jul 18, 2011 8:50 pm
by hk
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?
Do you notice a property that those multiple numbers have in common? (This has nothing to do with coding, but with math)

Re: Problem 001

Posted: Tue Jul 19, 2011 1:23 pm
by Plebian
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.

Re: Problem 001

Posted: Tue Jul 19, 2011 2:17 pm
by 243009558he
Edit: code snipped by hk.