Problem 391

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.
ffff0
Posts: 50
Joined: Sun Aug 21, 2011 6:26 am
Location: Moscow, Russian Federation

Re: Problem 391

Post by ffff0 »

I think there is no pattern, since limit is so low (1000).
Running program now which calculate it value individually.
Image
Larry_Hignight
Posts: 1
Joined: Thu Sep 27, 2012 12:32 am
Contact:

Re: Problem 391

Post by Larry_Hignight »

Hello all,

This is my first post, and boy am I stuck on this problem. =)

What I have done so far:
  • I understand the problem.
  • I can calculate the final value in Sk for any M(n).
  • I can correctly solve the Σ(M(n))3 = 8150 example in about 20 seconds of CPU time with an O(n) algorithm.
  • I also realize this approach won't succeed because the problem space is increasing exponentially.
Unfortunately, I can't think of anything else to cope with a problem space of this size and was wondering if someone might be able to point me to another problem that might nudge me in the right direction.
Image
User avatar
Marcus_Andrews
Administrator
Posts: 1637
Joined: Wed Nov 09, 2011 5:23 pm

Re: Problem 391

Post by Marcus_Andrews »

For many of the tougher Project Euler challenges, being able to synthesize the example-case solutions is a good sign that you've got a fairly good chunk of the puzzle figured out already. What I am about to say might sound obvious, but it might help to do some additional analysis of the problem. Play around with what you've got and see if there is some pattern or structure you can take advantage of to help speed up your algorithm.
ffff0
Posts: 50
Joined: Sun Aug 21, 2011 6:26 am
Location: Moscow, Russian Federation

Re: Problem 391

Post by ffff0 »

As I noted relatively low upper limit suggest that each value must be obtained individually and that computing and/or memory requirements are beyond O(n).

My approach works in O(n^4) time and takes O(n^3) memory, but it wasn't the best one.
Image
Post Reply