Project Euler Problems

Taken directly from

Project Euler is a series of challenging mathematical/computer programming problems that will require more than just mathematical insights to solve. Although mathematics will help you arrive at elegant and efficient methods, the use of a computer and programming skills will be required to solve most problems.

The motivation for starting Project Euler, and its continuation, is to provide a platform for the inquiring mind to delve into unfamiliar areas and learn new concepts in a fun and recreational context.

This page is dedicated to my attempts at solving and optimizing the Project Euler problems. I had originally solved a few of them in VB some time ago (the code is somewhere on this site), however I am currently going through them and redoing them in C++. Solutions and explanations will be posted here once complete. There are some guidelines I will be following regarding my optimization and timing:

  • All code will be executed on the same PC several times and the average run time will be recorded
  • Only the algorithm’s time will be recorded. I/O, variable declaration, and setup will not be recorded
  • All code will be run using VS2010 in debug mode with no compiler optimization
  • Timing will be calculated by the QueryPerformanceCounter
  • The smallest time amount I can get is 0 or 309 nanoseconds. I cannot get a time in between those since the QPC doesn’t seem to have that accuracy. I am considering any time amount of 309 nanoseconds to be “at most 309 nanosecond, but longer than 0 nanoseconds”

I am always open to new optimization techniques. If you see something that you think can be done better, let me know.