Problem 238

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.
Robert_Gerbicz
Posts: 26
Joined: Sat Oct 13, 2007 2:44 pm

Problem 238

Post by Robert_Gerbicz »

NB: The first posts in this topic refer to an earlier version of problem #238, which unfortunately had an error.
To fix it, the problem statement was modified. As a result, the (partial) answers posted below are no longer valid.
-Edited by harryh



I think this is a broken problem. My semi brute force code gives the same answers for N=10^8 and N=2*10^8 that my fast code. (for brute force obviously it is not so that easy if you have not got enough RAM, but if you replace the starting value(s) of the sequence then testing is easy).

//so I mean: sum(k=0,10^8,p(k)) and sum(k=0,2*10^8,p(k))
Last edited by harryh on Sun Mar 29, 2009 6:19 pm, edited 2 times in total.
Reason: Added note at the beginning.
quilan
Posts: 182
Joined: Fri Aug 03, 2007 11:08 pm

Re: Problem 238

Post by quilan »

I'm still working through this one (looked crazy challenging, so I couldn't resist). Once I've got my fast code developed a bit more, I'll see if I can't corroborate this.
ex ~100%'er... until the gf came along.
Image
Eigenray
Posts: 62
Joined: Mon Jul 14, 2008 5:20 pm

Re: Problem 238

Post by Eigenray »

Can you confirm: sum(k=0,10^8,p(k)) = 49...33, sum(0,2*10^8,p(k)) = 99...00?

I am inclined to agree there is something wrong.
Last edited by Eigenray on Fri Mar 27, 2009 3:43 pm, edited 1 time in total.
Robert_Gerbicz
Posts: 26
Joined: Sat Oct 13, 2007 2:44 pm

Re: Problem 238

Post by Robert_Gerbicz »

Yes, I've gotten the same results.
harryh
Posts: 2091
Joined: Tue Aug 22, 2006 9:33 pm
Location: Thessaloniki, Greece

Re: Problem 238

Post by harryh »

Well, it seems that at least one user got it right :)
To be sure, I've double-checked the answer entered in the database and it is the same as the one we found while developing the problem, so...
gonzolino
Posts: 17
Joined: Thu Mar 12, 2009 4:17 pm
Location: Lyon, France
Contact:

Re: Problem 238

Post by gonzolino »

I've got the same values for 10^8 and 2.10^8... strange !

And 49...89 for 10^14
Robert_Gerbicz
Posts: 26
Joined: Sat Oct 13, 2007 2:44 pm

Re: Problem 238

Post by Robert_Gerbicz »

harryh wrote:Well, it seems that at least one user got it right :)
To be sure, I've double-checked the answer entered in the database and it is the same as the one we found while developing the problem, so...
Or he/she found the same wrong way. Could you confirm the leading/trailing two digits for N=10^8 and for N=2*10^8 (posted above), if you have got a program... I've checked that my slow brute force and fast code gives the answers for N=k*10^6, where k=100..300, yes 201 big values, and there was no difference.
gonzolino
Posts: 17
Joined: Thu Mar 12, 2009 4:17 pm
Location: Lyon, France
Contact:

Re: Problem 238

Post by gonzolino »

I think Robert is right. And by the way, choosing n>10^8 is a good idea. Actually, chosing n>=80...91 is meaningful, hu ?
harryh
Posts: 2091
Joined: Tue Aug 22, 2006 9:33 pm
Location: Thessaloniki, Greece

Re: Problem 238

Post by harryh »

Considering that there is only one solution so far, it is possible that we overlooked something.
So, we are temporarily putting it on hold and a new e-mail notification will be sent a few hours before it becomes available again.
Our sincere apologies for the inconvenience.
mastro
Posts: 5
Joined: Fri Mar 27, 2009 6:35 pm

Re: Problem 238

Post by mastro »

I'm the one who solved the problem. I hope the problem (and my solution) is correct...
JohnMorris
Posts: 64
Joined: Sun Dec 23, 2007 6:38 am

Re: Problem 238

Post by JohnMorris »

I get the same results for 1e8, 2e8 and 1e14 as the previous posters.
Image
JohnMorris
Posts: 64
Joined: Sun Dec 23, 2007 6:38 am

Re: Problem 238

Post by JohnMorris »

harryh wrote:So, we are temporarily putting it on hold and a new e-mail notification will be sent a few hours before it becomes available again.
Now that we all have our code ready, there's going to quite a rush of submissions when it comes back :-)
Image
mastro
Posts: 5
Joined: Fri Mar 27, 2009 6:35 pm

Re: Problem 238

Post by mastro »

Robert_Gerbicz wrote:My semi brute force code gives the same answers for N=10^8 and N=2*10^8
As I said, I'm the one that first "solved" the problem and if I apply my fast algorithm to 10^8 and 2*10^8 i get two different values. The only way to get the same number is if all p(k) in that range are zero, which seems impossible given that w is a string of infinite length!
quilan
Posts: 182
Joined: Fri Aug 03, 2007 11:08 pm

Re: Problem 238

Post by quilan »

mastro wrote:
Robert_Gerbicz wrote:My semi brute force code gives the same answers for N=10^8 and N=2*10^8
As I said, I'm the one that first "solved" the problem and if I apply my fast algorithm to 10^8 and 2*10^8 i get two different values. The only way to get the same number is if all p(k) in that range are zero, which seems impossible given that w is a string of infinite length!
Interpreting what he said, he meant that the brute force & fast solutions agree for both k's. Not that they're the same value.
ex ~100%'er... until the gf came along.
Image
fra
Posts: 1
Joined: Mon Nov 10, 2008 1:57 pm

Re: Problem 238

Post by fra »

I also get the same results for 10E8, 2* 10E8, 10E14,.
BjornEdstrom
Posts: 37
Joined: Thu Nov 08, 2007 11:16 pm

Re: Problem 238

Post by BjornEdstrom »

I too confirm, 10^8, 2x10^8 and 10^14.
mastro
Posts: 5
Joined: Fri Mar 27, 2009 6:35 pm

Re: Problem 238

Post by mastro »

quilan wrote:Interpreting what he said, he meant that the brute force & fast solutions agree for both k's. Not that they're the same value.
Oops, sorry. You're right of course. Still my result for 10^8 is not the 49...33 mentioned by Eigenray and the one for 2*10^8 is not 99...00.

I'm either a genius or an extremely lucky idiot! :D
JohnMorris
Posts: 64
Joined: Sun Dec 23, 2007 6:38 am

Re: Problem 238

Post by JohnMorris »

mastro wrote:As I said, I'm the one that first "solved" the problem and if I apply my fast algorithm to 10^8 and 2*10^8 i get two different values.
Out of curiosity (and to check a wild surmise), what does your algorithm give for the first and last two digits for these?
Image
mastro
Posts: 5
Joined: Fri Mar 27, 2009 6:35 pm

Re: Problem 238

Post by mastro »

Thumbo wrote:Out of curiosity (and to check a wild surmise), what does your algorithm give for the first and last two digits for these?
I get 49...36 and 99...06. I'll try a brute force and see what I get.
JohnMorris
Posts: 64
Joined: Sun Dec 23, 2007 6:38 am

Re: Problem 238

Post by JohnMorris »

mastro wrote:
Thumbo wrote:Out of curiosity (and to check a wild surmise), what does your algorithm give for the first and last two digits for these?
I get 49...36 and 99...06. I'll try a brute force and see what I get.
Aha! Those match my surmise - I get those answers by including one easy to make error in my code. I'll pm harryh.
Image
Post Reply