Problem 050

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.
persa
Posts: 2
Joined: Mon Jul 28, 2008 2:00 pm

Problem 050

Post by persa »

I think that something's going wrong! The number 953 is prime but it isn't the longest sum of consecutive primes below one-thousand that adds to a prime. The number 281 has this property with 14 terms.
According to this, the prime, below one-million, which can be written as the sum of the most consecutive primes, is 958577 with 536 terms, but my answer is wrong. I wonder why?

harryh
Posts: 2091
Joined: Tue Aug 22, 2006 9:33 pm
Location: Thessaloniki, Greece

Re: incorect example in problem 50?

Post by harryh »

The problem states that 953 is a sum of 21 consecutive primes (actually : 7+11+13+...+83+89).
Isn't that a longer sum than the 14 terms adding up to 281 ?

persa
Posts: 2
Joined: Mon Jul 28, 2008 2:00 pm

Re: incorect example in problem 50?

Post by persa »

ok thanks!
I thouhgt that the sum should begin always from 2 (the first prime)

iamhigh
Posts: 7
Joined: Fri Apr 03, 2009 11:24 am

Problem 050

Post by iamhigh »

These consecutive numbers start from 2 or any prime number?

harryh
Posts: 2091
Joined: Tue Aug 22, 2006 9:33 pm
Location: Thessaloniki, Greece

Re: Problem 050

Post by harryh »

Well, as you can see there was already a topic for this problem (I have just merged the two topics). So:
(a) There was no need to start a new topic.
(b) The answer to your question was there already :)

iamhigh
Posts: 7
Joined: Fri Apr 03, 2009 11:24 am

Re: Problem 050

Post by iamhigh »

Thanks harryh - I can swear I searched for "Problem 050" but nothing showed up on the search results - Do they get archived after a period of neglect?

User avatar
daniel.is.fischer
Posts: 2400
Joined: Sun Sep 02, 2007 11:15 pm
Location: Bremen, Germany

Re: Problem 050

Post by daniel.is.fischer »

No, but the search term "Problem xxx" is too generic to produce results.

Go to the bottom of the forum page, there you have the opportunity to change by which criteria the topics are sorted. Sort by subject, and it's easy to find (if it's there already).
Il faut respecter la montagne -- c'est pourquoi les gypaètes sont là.

srmackey
Posts: 2
Joined: Wed Nov 04, 2009 1:55 pm

Re: Problem 050

Post by srmackey »

The problem states:

"The longest sum of consecutive primes below one-thousand that adds to a prime, contains 21 terms, and is equal to 953."

II always come up with something different. I get 961 as a sum of 23 primes.

961 = 3 + 5 + 7 + 11 + 13 + 17 + 19 + 23 + 29 + 31 + 37 + 41 + 43 + 47 + 53 + 59 + 61 + 67 + 71 + 73 + 79 + 83 + 89

Can anyone verify if my answer is incorrect? I have solved the problem, but I'm curious about this discrepancy.

genious999
Posts: 53
Joined: Mon Oct 20, 2008 10:48 pm

Re: Problem 050

Post by genious999 »

srmackey wrote:The problem states:

"The longest sum of consecutive primes below one-thousand that adds to a prime, contains 21 terms, and is equal to 953."

II always come up with something different. I get 961 as a sum of 23 primes.

961 = 3 + 5 + 7 + 11 + 13 + 17 + 19 + 23 + 29 + 31 + 37 + 41 + 43 + 47 + 53 + 59 + 61 + 67 + 71 + 73 + 79 + 83 + 89

Can anyone verify if my answer is incorrect? I have solved the problem, but I'm curious about this discrepancy.
961=31*31, so that sum is not a prime.

srmackey
Posts: 2
Joined: Wed Nov 04, 2009 1:55 pm

Re: Problem 050

Post by srmackey »

genious999 wrote:961=31*31, so that sum is not a prime.
Ah... good call. There must be something wrong with my sieve algorithm. Thanks for the feedback!

abranches
Posts: 1
Joined: Sat Nov 20, 2010 2:36 pm

Re: Problem 050

Post by abranches »

Why the largest below 1000 is
953 = 7 + 11 + 13 + 17 + 19 + 23 + 29 + 31 + 37 + 41 + 43 + 47 + 53 + 59 + 61 + 67 + 71 + 73 + 79 + 83 + 89
and not
983 = 23 + 29 + 31 + 37 + 41 + 43 + 47 + 53 + 59 + 61 + 67 + 71 + 73 + 79 + 83 + 89 + 97

Both are primes and the sum of primes in sequence.
So the largest should be 983. What I'm doing wrong here?

Ok I got it... is the largest in number of terms.

JMW1994
Posts: 43
Joined: Sat Apr 09, 2011 11:35 pm

Re: Problem 050

Post by JMW1994 »

abranches wrote:Why the largest below 1000 is
953 = 7 + 11 + 13 + 17 + 19 + 23 + 29 + 31 + 37 + 41 + 43 + 47 + 53 + 59 + 61 + 67 + 71 + 73 + 79 + 83 + 89
and not
983 = 23 + 29 + 31 + 37 + 41 + 43 + 47 + 53 + 59 + 61 + 67 + 71 + 73 + 79 + 83 + 89 + 97

Both are primes and the sum of primes in sequence.
So the largest should be 983. What I'm doing wrong here?

Ok I got it... is the largest in number of terms.
Why did you skip 2,3, and 5? At 21 numbers, I get 712, but 281 was the largest so I'm wrong somewhere.
Image

thundre
Posts: 356
Joined: Sun Mar 27, 2011 10:01 am

Re: Problem 050

Post by thundre »

JMW1994 wrote:Why did you skip 2,3, and 5? At 21 numbers, I get 712, but 281 was the largest so I'm wrong somewhere.
712 is not prime.
Image

JMW1994
Posts: 43
Joined: Sat Apr 09, 2011 11:35 pm

Re: Problem 050

Post by JMW1994 »

thundre wrote:
JMW1994 wrote:Why did you skip 2,3, and 5? At 21 numbers, I get 712, but 281 was the largest so I'm wrong somewhere.
712 is not prime.
Well, I knew that. The problem states:
The prime 41, can be written as the sum of six consecutive primes:

41 = 2 + 3 + 5 + 7 + 11 + 13
This is the longest sum of consecutive primes that adds to a prime below one-hundred.

The longest sum of consecutive primes below one-thousand that adds to a prime, contains 21 terms, and is equal to 953.

Which prime, below one-million, can be written as the sum of the most consecutive primes?
When I tried to solve the largest one-thousand consecutive prime and I had 21 prime terms,including 2, 3, and 5, I got the number 712 which is obviously a composite number. I got 281 as the largest which wasn't correct. Besides, I never got and answer from my last question. The question was: Why did you skip 2,3, and 5?
Image

User avatar
jaap
Posts: 551
Joined: Tue Mar 25, 2008 3:57 pm
Contact:

Re: Problem 050

Post by jaap »

JMW1994 wrote:The question was: Why did you skip 2,3, and 5?
Why not? The question states only that the sequence of primes is consecutive, not that it must start at 2.

JMW1994
Posts: 43
Joined: Sat Apr 09, 2011 11:35 pm

Re: Problem 050

Post by JMW1994 »

My next question is why isn't 2, 3, or 5 consecutive?
Image

TripleM
Posts: 382
Joined: Fri Sep 12, 2008 3:31 am

Re: Problem 050

Post by TripleM »

Your questions aren't really making much sense.. 2, 3, and 5 are consecutive primes; they're even shown in the example in the problem as being consecutive primes. Nobody has said that they aren't.

apdwyer51
Posts: 5
Joined: Sun Nov 27, 2011 8:46 pm

Project 50

Post by apdwyer51 »

I have a question about the directions for this problem. When you click on the problem it gives the following examples:

it adds the first 6 primes and gets 41 then says that this: This is the longest sum of consecutive primes that adds to a prime below one-hundred. I get this.

Then it says:

The longest sum of consecutive primes below one-thousand that adds to a prime, contains 21 terms, and is equal to 953.

But when I add the first 21 prime numbers together, I get 712, not 953. When I add the first 24 primes together, I get 963, completely skipping 953. This makes me think that I don't quite understand what the problem is asking.

Can someone explain how the first 21 terms gives 953?

Thanks.

wrongrook
Posts: 397
Joined: Sat Oct 17, 2009 10:39 pm

Re: Project 50

Post by wrongrook »

The sum does not have to start with 2.

e.g. 7+11+13 = 31 would be another example.

Eternalcode
Posts: 12
Joined: Mon Oct 03, 2011 2:25 am
Location: California, USA

Re: Project 50

Post by Eternalcode »

When the problem says

"The longest sum of consecutive primes below one-thousand that adds to a prime, contains 21 terms, and is equal to 953."

That does not mean
from 2 to the 21st prime number below one-thousand.

Whenn you add X amonunt of consecutive primes below that upperbound, it should result in being the longest chain within on-thousand.

Good luck.
Image

Post Reply