Project Euler

Everything regarding Project Euler solutions.

Project Euler – Problem 4

Today it is time to look at the solution to Problem 4 of Project Euler. It differs a bit in the nature of the problem from the first 3 we have looked at so far. However, it is still mathematics and a solution can still be coded, and most important it is still fun.

The problem formulation reads:

A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 * 99.

Find the largest palindrome made from the product of two 3-digit numbers.

I think it is a nice recreational little exercise.

Continue reading →

Posted by Kristian in Project Euler, 29 comments

Project Euler – Problem 3

I am sorry, I haven’t posted anything for a while. I have been busy moving, and is currently without an Internet connection. However I couldn’t keep away any more.

Problem 3 in Project Euler reads:

The prime factors of 13195 are 5, 7, 13 and 29.

What is the largest prime factor of the number 600851475143 ?

I used two different approaches for this, and lets get right to them. Continue reading →

Posted by Kristian in Project Euler, 27 comments

Project Euler – Problem 2

The problem description of Problem 2 of Project Euler reads

Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:

1, 2, 3, 5, 8, 13, 21, 34, 55, 89, …

Find the sum of all the even-valued terms in the sequence which do not exceed four million.

Before heading on with a solution, I will make a small comment on the problem formulation. Usually the first two numbers in the Fibonacci sequence is defined as F1 = F2 = 1. But that is just nitpicking and wont change anything in the solution.

Continue reading →

Posted by Kristian in Project Euler, 31 comments

Project Euler – Problem 1

Now that the fluff around the coding is covered, we are ready to solve the first problem.

The description of problem 1 on Project Euler reads

Find the sum of all the multiples of 3 or 5 below 1000.

There are multiple methods for finding the solution for this problem…
Continue reading →

Posted by Kristian in Project Euler, 54 comments

Project Euler – Prolog

Recently I found a website called Project Euler. It is a website, which has a series of problems which can be solved using a mix of math and programming. I like both math and programming, so I really do enjoys the problems. I have only solved a fraction of the problems, but I have already touched many branches of mathematics I usually don’t dabble much in.

It is stated that the problems should be solvable in under one minute once a program has been written. Writing the programs might takes several hours though, and this is the fun challenge is.

In this series of posts, I will gives a run through, and a solution methodology for solving some of the problems (the ones I have solved…), but I will in each case elaborate a bit more on it, than just finding a solution.

The code for these problems will be written in C#, and I wont provide the full code, only the useful snippets. I will use this first blog post on the subject to give you a bit of the structure around the interesting code.

Continue reading →

Posted by Kristian in Project Euler, 0 comments