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.
- hk
- Administrator
- Posts: 12832
- Joined: Sun Mar 26, 2006 10:34 am
- Location: Haren, Netherlands
Re: problem #1
Perhaps you noted this icon next to the link to the forum.
This icon gives access to an overview for the problem , with a reasonable efficient solution at the end of it.
This icon gives access to an overview for the problem , with a reasonable efficient solution at the end of it.
You do not have the required permissions to view the files attached to this post.

War ruins the life and health of untold numbers of innocent children.
-
Programmist
- Posts: 2
- Joined: Wed Oct 15, 2008 8:42 pm
Re: problem #1
Right - got the PDF. Thanks for the tip. I used a repeating 7-element pattern to solve it. I don't want to get any more specific so I don't give it away to anyone who has not solved the problem. Mine was not the most efficient solution, but might be unique.
@Ikcelaks: I'm not sure what you mean by "The question doesn't ask you to find the numbers. It asks you to find how many numbers there are." My reading of the question says it asks for a sum of numbers.
@Ikcelaks: I'm not sure what you mean by "The question doesn't ask you to find the numbers. It asks you to find how many numbers there are." My reading of the question says it asks for a sum of numbers.
- rayfil
- Administrator
- Posts: 1412
- Joined: Sun Mar 26, 2006 5:30 am
- Location: Quebec, Canada
- Contact:
Re: problem #1
You are absolutely correct on that point. However, there are means of arriving at the solution without the need of identifying any of the numbers.Programmist wrote:My reading of the question says it asks for a sum of numbers.
When you assume something, you risk being wrong half the time.
-
quilan
- Posts: 182
- Joined: Fri Aug 03, 2007 11:08 pm
- hk
- Administrator
- Posts: 12832
- Joined: Sun Mar 26, 2006 10:34 am
- Location: Haren, Netherlands
Re: problem #1
Given a cool head and what you learned in the pdf, you can transform your repeating 7-element pattern also into a O(1) algoritm.Programmist wrote:Right - got the PDF. Thanks for the tip. I used a repeating 7-element pattern to solve it. I don't want to get any more specific so I don't give it away to anyone who has not solved the problem. Mine was not the most efficient solution, but might be unique.
@Ikcelaks: I'm not sure what you mean by "The question doesn't ask you to find the numbers. It asks you to find how many numbers there are." My reading of the question says it asks for a sum of numbers.

War ruins the life and health of untold numbers of innocent children.
-
Ikcelaks
- Posts: 28
- Joined: Wed Oct 15, 2008 9:08 pm
Re: problem #1
Oops, I should have reread the problem, because I must have forgotten it. On the other hand, you could take my slip-up as a decent hint.My reading of the question says it asks for a sum of numbers.
-
AlbertoEAF
- Posts: 1
- Joined: Tue Oct 21, 2008 11:42 pm
Re: problem #1
I've tried this over and over and doesn't work, I'm doing it in python and in the attachment you have my program's source code.
Could someone send me the solution (result)? Or tell me what is wrong with my program? Any of those will do
EDIT: I've done it, it was probably a problem in the server because my answer didn't change but in the day after it worked.
Could someone send me the solution (result)? Or tell me what is wrong with my program? Any of those will do
EDIT: I've done it, it was probably a problem in the server because my answer didn't change but in the day after it worked.
-
Keybounce
- Posts: 1
- Joined: Mon Mar 01, 2010 2:25 am
Re: problem #1
Nope. I cannot find this. I also did not see a link to the problem.hk wrote:Perhaps you noted this icon next to the link to the forum.
This icon gives access to an overview for the problem , with a reasonable efficient solution at the end of it.
Lets see if this works: Problem 1 (View Problem)
Yep
Keybounce
New solver.
- hk
- Administrator
- Posts: 12832
- Joined: Sun Mar 26, 2006 10:34 am
- Location: Haren, Netherlands
Re: problem #1
Of course you must solve the problem first before the mentioned links are shown.Keybounce wrote:Nope. I cannot find this. I also did not see a link to the problem.hk wrote:Perhaps you noted this icon next to the link to the forum.
This icon gives access to an overview for the problem , with a reasonable efficient solution at the end of it.
Lets see if this works: Problem 1 (View Problem)
Yep
Keybounce
New solver.

War ruins the life and health of untold numbers of innocent children.
-
h2o4444
- Posts: 1
- Joined: Mon Jul 05, 2010 5:44 am
Problem 1
Hello, I'm a newbie at Python so I'm trying to learn by doing. I have no idea how to even do the first problem on ProjectEuler, can anyone help me?
The first problem is:
"If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000."
Thanks.
The first problem is:
"If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000."
Thanks.
-
triglios
- Posts: 1
- Joined: Mon Jul 05, 2010 11:49 am
Re: Problem 1
there is 2 parts in this problem , find all the number from 3 to 1000 multiple of 3 or 5 , and sum them. the divisibility test is a%b in python (it returns the remainder of a/b), i think you have all you need here.
-
MekeorMelire
- Posts: 4
- Joined: Mon Aug 16, 2010 8:23 pm
- Location: Germany
Re: Problem 001
I HATE LANGUAGES!!! - they are very inaccurate!
or means in my eyes "Logical disjunction".
the truth table of a "Logical disjunction" can you see here:http://en.wikipedia.org/wiki/Logical_di ... ruth_table.
but in Problem 1, there's no "either" so actually it should be a "Logical disjunction", but it isn't!
PLEASE correct the problem to:
or means in my eyes "Logical disjunction".
the truth table of a "Logical disjunction" can you see here:http://en.wikipedia.org/wiki/Logical_di ... ruth_table.
but in Problem 1, there's no "either" so actually it should be a "Logical disjunction", but it isn't!
PLEASE correct the problem to:
If we list all the natural numbers below 10 that are multiples of either 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of either 3 or 5 below 1000.
- elendiastarman
- Posts: 410
- Joined: Sat Dec 22, 2007 8:15 pm
Re: Problem 001
Ah, I beg to differ. The correct includes 15, 30, 45, etc... (although not twice), all of which are a multiple of 3 and 5. So yes, it is a logical disjunction.
Want some
3.14159265358979323846264338327950288419716939937510
58209749445923078164062862089986280348253421170679...?

3.14159265358979323846264338327950288419716939937510
58209749445923078164062862089986280348253421170679...?

-
gipsy86147
- Posts: 1
- Joined: Wed Aug 18, 2010 12:27 pm
- hk
- Administrator
- Posts: 12832
- Joined: Sun Mar 26, 2006 10:34 am
- Location: Haren, Netherlands
Re: Problem 001
First of all: don't post solutions for the problems in this forum. The problems are meant to be solved by the members themselves.
Secondly: if you'd read the overview for this problem you'd known that this solution is far from optimal.
Secondly: if you'd read the overview for this problem you'd known that this solution is far from optimal.

War ruins the life and health of untold numbers of innocent children.
- Slaunger
- Posts: 40
- Joined: Tue Jul 20, 2010 12:23 am
Re: Problem 001
Albeit I agree, it is not an optimal solution, it is a solution which is fine for the beginning PE solver. Thus, I think it is a spoiler, and I would urge it to be either hidden as a spoiler or (preferably) removed. If I were a beginning PE user coming to the forum, I would be a bit dissapointed to see an actual solution, as it would not be what I was after. OK, problem 1 is a bit special, as it is the simplest and widely publicly known. E.g., a slightly better Python version (using a sum over an iterator instead of a list) is available on Wikipedia in the article describing Project Euler:hk wrote:...
Secondly: if you'd read the overview for this problem you'd known that this solution is far from optimal.
(that's why I didn't snip your code).
http://en.wikipedia.org/wiki/Project_Euler
But out of principle I do not think we should have any complete published solutions in this forum visible to the eye when scrolling thorugh the posts for a specific problem.

- hk
- Administrator
- Posts: 12832
- Joined: Sun Mar 26, 2006 10:34 am
- Location: Haren, Netherlands
Re: Problem 001
Spoiler removed.

War ruins the life and health of untold numbers of innocent children.
-
BeulerBeuler
- Posts: 1
- Joined: Sat Aug 21, 2010 6:38 am
Re: Problem 001
Quilan's advice above is so good that I would go farther. If you take his advice, you can solve this problem in your head without a computer program. (Who else did this?)
-
rae3012
- Posts: 1
- Joined: Tue Sep 07, 2010 11:25 pm
Re: Problem 001
Hello, I am a very new programmer, and I was told about the Euler site by a friend. Today is my first day to use Python, and I need some help regarding the code that I have. It seems like it would work from a logical standpoint, but I cannot get it to execute. If someone would be so kind as to offer their assistance via PM, I would greatly appreciate it.
