Euler 70

I finished problem 70 from Project Euler. My submission was based on a largely brute-force approach, but one which was guaranteed to find the answer. After submitting, I read through the problem discussion, and the fast solutions all seemed to rely on really educated guesswork.

This bothers me a bit. The guesswork for the fast solution is based on analysis of the problem, and it is sound as far as it goes. But I am still not convinced that the fast approaches are actually general in that they would work for any target number (10e7 in the case of the problem.)

My instinct in the Euler problems is to provide a generalized solution and then apply that solution to the particular input. As in this case, it doesn’t always yield the fastest solution, but I feel a moral responsibility to do it. I get the sense that many others aim to write a solution that is highly optimized (some might say over-trained) for the specific input.

In any event, once I read about the faster approaches and appreciated the thinking behind them, I implemented my own version. There is something to be said about really fast code 🙂

Advertisements

,

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: