First Place at Project Euler

Project Euler hosts a growing collection of math programming problems that I started participating in earlier this year while it was on the mathschallenge.net web site. Typically, you have to write a program to solve a math problem and then enter your solution to get credit for it. It took me a couple of months to solve all the existing problems, and since then I’ve been solving new problems as they come out, every few weeks.

There are about 50 participants who solve all the problems as they come out and maintain their status as “100% genius” at the site. Among those, there are about a dozen who compete to solve new problems as quickly as possible since ties in the rankings are broken by time of submission of the solution. New problems always come out on Fridays at 1pm (EST) so I usually don’t get to work on them until the evening, which typically results in a “ranking” of around #15.

This week I was off work for the holidays and delayed our trip up to Hyco Lake for a few hours so I could take a crack at the new problems coming out. There were two new problems this time, involving finding solutions to the same Diophantine equation for certain values of n. In the first problem n was bounded to 1 million, and a simple brute force search worked fine. The second problem allowed n to go to 50 million. I started a similar brute force search running just in case it finished, though I knew there must be a simpler solution (all problems are designed to take less than a minute to execute). Being in a hurry, I only did a little analysis and then studied the first hundred or so brute force solutions to find a pattern and guessed that the pattern held for the whole range. It worked, and I ended up in first place on the scores list, at least until the next problem comes out.

Later, I let the brute force attack complete, which took about an hour. I also took the time to figure out why the pattern I observed held.

5 Responses to “First Place at Project Euler”

  1. John Schroedl says:

    Congrats!

  2. Ann Lehman says:

    Great!
    Maybe you should take off a couple of hours on Friday afternoons, and do JMP work later.

  3. xan says:

    Good idea, Ann! I don’t know if “euler” heard my whining or not, but he’s just announced that release times for new problems will now be staggered throughout the day.

  4. Mio says:

    You beat me by a minute this week Xan! (I’m yelling this in William Shatner voice:) Congrats! Next week Xan, next week!

  5. xan says:

    Thanks for the motivation, Mio. Good luck.

Leave a Reply