Scrupuli

blunt essays with sharp points

I have been attacking the problems at Project Euler.net

by Scrvpvlvs
Apr 26, 2011 6:30 PM–… and Project Euler is winning Round 34.

I have been working my way through some fun problems at Project Euler.net. Fun for me, anyway. To solve them takes what Edsger Dijkstra called mathematical engineering: mathematics and programming skills used together.

There are many problems to choose from, from very easy to very challenging. But they all have this in common: though it takes time and thought to analyze each problem, the solution should run on any basic computer in less than a minute.

Which is great! It means that nobody needs a supercomputer to solve these problems: just a PC and the will to learn and succeed.

Which brings me to Problem 34, find the sum of all numbers which are equal to the sum of the factorial of their digits. This problem is eating my lunch.

My solutions to problems 1–33 were sometimes lazy. Yes, some run under a millisecond, or scale to much bigger problems than those posed … but I have also been perfectly satisfied with brute force solutions if they ran under a minute on my old PC.

But, so far, my solution to Problem 34 takes more than 2 minutes to run and its output is rejected by Project Euler for no good reason that I can see. Suddenly I cannot afford to be lazy.

Incidentally, all my solutions are written in Perl. I have, as I hoped, learned quite a bit about optimizing Perl programs that I did not know before.

In case you can’t tell, I am really enjoying this!

Labels: , , , , , , , ,

Share: submit to reddit

1 Comments:

by Blogger Keverdy13
July 01, 2011 12:11 AM–Woa! That is so cool! Thanks for sharing. I am so subscribing. And thanks for recommending Perl.  

Post a Comment

<< Home

about.me

Follow

feed

E-mail: enter address

Project Euler competitor metaed

vs.

Project Euler competitor db8

profile for MetaEd on Stack Exchange, a network of free, community-driven Q&A sites

Recent Articles

Do it yourself repair of a Panasonic KX-FL511 fax ...

Google Chrome On Track To Overtake Firefox

Do not cede moral high ground to Pope

Geminid meteor shower TONIGHT: predicted to be bes...

New buttons and options being tested in Google Map...

The Power Of Prayer

SourceForge Does Evil?

Faith Is Not A Renunciation Of Evidence

Manic And Depressed All At Once? That’s Normal

Make Firefox Take Geolocation From Google Latitude...

Archives

November 1999
June 2000
July 2000
September 2001
October 2001
February 2002
March 2002
June 2003
February 2004
June 2004
July 2004
August 2004
September 2004
February 2005
March 2005
November 2005
July 2007
March 2008
April 2008
May 2008
October 2008
November 2008
December 2008
January 2009
April 2009
September 2009
December 2009
February 2010
March 2010
May 2010
June 2010
September 2010
October 2010
November 2010
December 2010
January 2011
April 2011
June 2011
July 2011
August 2011
September 2011
December 2011
February 2012
April 2012
May 2012
June 2012
July 2012
August 2012
September 2012
November 2012
January 2013
February 2013
April 2013
February 2014
May 2014
October 2014