August 31, 2012

I recently started going through the problems on Project Euler, and put my solutions up at my GitHub account. The problems are mostly mathematical problems that can be solved programmatically. Most of the solutions that I’ve written are just naive brute force algorithms. A few of them take a long time to run, so I wrote the program to be threaded; in particular finding sum of all primes below 2 million and finding the first triangle number to have over 500 divisors.

I’ve written most of my solutions in C, with 1 solution in Java (finding the sum of the digits of 2^1000) because BigInteger is super easy to use. It’s fun to write little C programs, and I’ve gotten the chance to learn about pthreads and the GMP library. Most of my solutions could be further refined to reduce the runtime, but since each solution only needs to be run once (I only need to find the answer once!), there isn’t a huge incentive to keep working on a solution once it works. Hopefully I have time to solve more problems soon.