The sum of the primes below 10 is

Find the sum of all the primes below two million.

# Monthly Archives: September 2009

# Project Euler: Just two tiny notes

Just two things I felt like mentioning:

## Thing number one

I got tired of the page 2 stuff. So, I swapped all the <!–nextpage–> things with <!–more–> and a header. Which means that the solution will now be on the same page as the problem. (Although not on the index page).

## Thing number two

My brother puts his whole solution on a public subversion repository, which is a very good idea. Following his good example, ~~I did a repository dump of my local VisualSVN Server and… undumped(??) it into one I set up here on my web host which I will be using from now on instead.~~

**Update:** SubVersion turned out to be a bit blah sometimes, so I am trying out Mercurial now instead. The repository has been converted and published on BitBucket. Mercurial seems a lot nicer than SubVersion so far. You can find a very good introduction at hginit.com.

## Thing number three

Ok, ok, the topic says two, but I just figured I should maybe mention one more thing. You see, the code you will find in my aforementioned subversion repository cannot be run. Like, there is no main method or anything there. That is because I am trying to teach myself how to use test cases, etc. So, instead of creating an executable program for each problem or one program with fancy “Solve problem #n”-buttons, I decided to just do it all in test cases. So, my solutions are actually found as part of the test project (well, the running of them anyways). I am using TestDriven.net to run them, and it works great. This way I can also do a lot of changes, and then just run my tests and make sure that all my solutions still calculate correctly. Awesome stuff.

# Project Euler: Problem 9

A Pythagorean triplet is a set of three natural numbers, for which,

For example,

There exists exactly one Pythagorean triplet for which,

Find the product abc.

# Project Euler: Problem 8

Find the greatest product of five consecutive digits in the 1000-digit number.

73167176531330624919225119674426574742355349194934

96983520312774506326239578318016984801869478851843

85861560789112949495459501737958331952853208805511

12540698747158523863050715693290963295227443043557

66896648950445244523161731856403098711121722383113

62229893423380308135336276614282806444486645238749

30358907296290491560440772390713810515859307960866

70172427121883998797908792274921901699720888093776

65727333001053367881220235421809751254540594752243

52584907711670556013604839586446706324415722155397

53697817977846174064955149290862569321978468622482

83972241375657056057490261407972968652414535100474

82166370484403199890008895243450658541227588666881

16427171479924442928230863465674813919123162824586

17866458359124566529476545682848912883142607690042

24219022671055626321111109370544217506941658960408

07198403850962455444362981230987879927244284909188

84580156166097919133875499200524063689912560717606

05886116467109405077541002256983155200055935729725

71636269561882670428252483600823257530420752963450

# Project Euler: Problem 7

By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.

What is the 10001st prime number?

# WP Latex test page

So, as my brother noticed in my last post, I have some cool equations here. The brilliance behind it is something called LaTeX, which can be used in WordPress blogs thanks to the WP LaTeX plugin.

I am a total LaTeX newbie though, so I often struggle a bit with… getting it right. Trying it out by previewing WordPress posts is sloooow, so I decided to create myself a simple test-rig. A simple web page with a form and a button.

Let me know if you like it: tools.geekality.net/wp-latex

# Project Euler: Problem 6

The sum of the squares of the first ten natural numbers is,

The square of the sum of the first ten natural numbers is,

Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025 — 385 = 3640.

Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.

So, apparently my brother has joined me on my Project Euler solving quest. You can see his Delphi solution on his blog. My C# solution, you can find below