Problem 001

A place to air possible concerns or difficulties in understanding ProjectEuler problems. This forum is not meant to publish solutions. This forum is NOT meant to discuss solution methods or giving hints how a problem can be solved.
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.

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


See also the topics:
Don't post any spoilers
Comments, questions and clarifications about PE problems.
Post Reply
sharkz
Posts: 4
Joined: Thu Jan 13, 2011 8:48 pm

Re: Problem 001

Post by sharkz »

yes and 15 is a multiple of both 3 and 5, and because of that, my program counts it two times (so 2x +15 to sum) - or is this wrong?
User avatar
stijn263
Posts: 1505
Joined: Sat Sep 15, 2007 11:57 pm
Location: Netherlands

Re: Problem 001

Post by stijn263 »

That's wrong, you should only count it once
wygk123
Posts: 3
Joined: Wed Feb 09, 2011 2:10 pm

Re: Problem 001

Post by wygk123 »

The java solution:

{code snipped by hk}
User avatar
stijn263
Posts: 1505
Joined: Sat Sep 15, 2007 11:57 pm
Location: Netherlands

Re: Problem 001

Post by stijn263 »

In particular don't post any code fragments or results.
Besides, your solution seems rather slow when the limit is changed to 10^18 ;)
alto
Posts: 2
Joined: Mon Feb 14, 2011 11:29 pm

Problem 001

Post by alto »

I'm almost positive that I did it correctly so if there's someone I could PM what I used to find the answer, that'd be great.
TripleM
Posts: 384
Joined: Fri Sep 12, 2008 3:31 am

Re: Problem 001

Post by TripleM »

There's already a thread for problem 1 here: viewtopic.php?f=50&t=965

If you still haven't worked out the problem after reading those 5 pages, feel free to PM me (but not before :))
alto
Posts: 2
Joined: Mon Feb 14, 2011 11:29 pm

Re: Problem 001

Post by alto »

They were using c++ as hints but I'm running it in python. I read through all 5 pages and got no tip at all. So I'll PM you the small code :)
User avatar
formicFabricant
Posts: 3
Joined: Fri Mar 25, 2011 4:00 pm

Re: Problem 001

Post by formicFabricant »

I read through the entire old thread (the one that's unlocked after you give the correct answer) and I couldn't find a single Ruby solution under 60 chars! Honestly...I came up with one in 51 and I'm sure I could do better.
User avatar
kevinsogo
Administrator
Posts: 1204
Joined: Thu Sep 16, 2010 4:39 am
Location: Manila, Philippines

Re: Problem 001

Post by kevinsogo »

@formicFabricant
Although a very short code is nice and elegant, I don't think it would add much to the discussion.

I've not coded in ruby before but after installing ruby and a few reading I was able to write a 44-character ruby program that solves problem 1. If you're interested I could PM it.
RodL
Posts: 1
Joined: Fri Apr 29, 2011 5:03 am

Needing help understanding Problem 1

Post by RodL »

By the sum of multiples of 3 OR 5 we mean to gather the sum of multiples of both 3 and 5 making sure that we only add the LCM of both 3 & 5 once (ex, 15 being the LCM of 3 and 5, we would only add 15 ONCE to the total summation rather than twice when 5*3 is reached.)

I'm getting like 80,000+ as my sum because 3*333 being the top-most multiple that equates to below 1000. But why is the solution much, much lower than 80,000?

If I could PM my code that would be great to someone.
TripleM
Posts: 384
Joined: Fri Sep 12, 2008 3:31 am

Re: Needing help understanding Problem 1

Post by TripleM »

Please use existing threads if one exists - here's the one for problem 1: viewtopic.php?f=50&t=965

If you've read all 5 pages of that and are still stuck, then (and only then :)) you can PM me.

(PS - I'm not sure where you heard the answer was much less than 80000, but that's not true.)
User avatar
rayfil
Administrator
Posts: 1412
Joined: Sun Mar 26, 2006 5:30 am
Location: Quebec, Canada
Contact:

Re: Problem 001

Post by rayfil »

@RodL

For ease of listing alphabetically and searching in this topic, all problem numbers have 3 digits, using leading 0's for problem numbers under 100.
When you assume something, you risk being wrong half the time.
SyGeek
Posts: 2
Joined: Sat Jun 04, 2011 2:29 am

Re: Problem 001

Post by SyGeek »

Is it possible to find the answer by adding some of each groups (0-10, 10-20, 20-30 and so on) by following the pattern that each consecutive group has a difference of 47.

70(10-20) - 23(0-10) = 47
117(20-30) - 70(10-20) = 47
User avatar
jaap
Posts: 588
Joined: Tue Mar 25, 2008 3:57 pm
Contact:

Re: Problem 001

Post by jaap »

SyGeek wrote:Is it possible to find the answer by adding some of each groups (0-10, 10-20, 20-30 and so on) by following the pattern that each consecutive group has a difference of 47.

70(10-20) - 23(0-10) = 47
117(20-30) - 70(10-20) = 47
0-9: 3+5+6+9 = 23
10-19: 10+12+15+18 = 55
20-29: 20+21+24+25+27 = 117
30-39: 30+33+35+36+39 = 173
SyGeek
Posts: 2
Joined: Sat Jun 04, 2011 2:29 am

Re: Problem 001

Post by SyGeek »

^Just found that I don't have to add 15 x 2 times...Meh, maths is not for me. I'll still try though
Yemen
Posts: 1
Joined: Mon Jun 06, 2011 7:01 am

Re: Problem 001

Post by Yemen »

Using python I used a similar brute force solution to many others
Expand
[code]

As you did not snip your code yourself I did (hk)
[/code]
After which I found a simple, elegant, one-line solution
Expand
[code]
As you did not snip your code yourself I did (hk)
[/code]
Although there's probably a way that this can be made simpler and quicker...
User avatar
Lord_Farin
Posts: 239
Joined: Wed Jul 01, 2009 10:43 am
Location: Netherlands

Re: Problem 001

Post by Lord_Farin »

Yemen wrote:Using python I used a similar brute force solution to many others

Code: Select all

[snip]
After which I found a simple, elegant, one-line solution

Code: Select all

[snip]
Although there's probably a way that this can be made simpler and quicker...
Would you now please take the time and read the BIG RED BOX on top of the page, and act accordingly? Thanks in advance. Please excuse my outburst as you are not the first person to ignore the obvious. Again, this is a publicly visible forum, and people may or may not have already solved problem 1. You are spoiling it for them.
Image
User avatar
hk
Administrator
Posts: 12832
Joined: Sun Mar 26, 2006 10:34 am
Location: Haren, Netherlands

Re: Problem 001

Post by hk »

Yemen, you're probably new here, but when entering a new place, it would show good manners if you would read the rules before posting.
I sent you a warning.
Please remove your spoilers.

@Lord_Farin: if this kind of behaviour starts irritating you, just ignore. The admins will handle in a few minutes/hours more.
Image
War ruins the life and health of untold numbers of innocent children.
User avatar
Lord_Farin
Posts: 239
Joined: Wed Jul 01, 2009 10:43 am
Location: Netherlands

Re: Problem 001

Post by Lord_Farin »

hk wrote:@Lord_Farin: if this kind of behaviour starts irritating you, just ignore. The admins will handle in a few minutes/hours more.
You are absolutely right. Thanks for stating the obvious. I appreciate what you and the rest of the team go through to keep it enjoyable for everyone. Thanks again.
Image
User avatar
hk
Administrator
Posts: 12832
Joined: Sun Mar 26, 2006 10:34 am
Location: Haren, Netherlands

Re: Problem 001

Post by hk »

Lord_Farin wrote:
hk wrote:
You are absolutely right. Thanks for stating the obvious. I appreciate what you and the rest of the team go through to keep it enjoyable for everyone. Thanks again.
No problem. I'm pleased to keep the site running, even if that means some additional tasks. 8-)
Image
War ruins the life and health of untold numbers of innocent children.
Post Reply