Project Euler – Problem 5

Lets jump right into solving Problem 5 of Project Euler and let me try to give you an answer on how to solve it. The problem formulation is :

2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.

What is the smallest positive number that is evenly divisible (divisible with no remainder) by all of the numbers from 1 to 20?

Once again I will provide you with two different solutions and some tips and tricks on how to speed them up a bit.
Continue reading →

Posted by Kristian in Project Euler, 33 comments

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, 28 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, 23 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, 27 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, 47 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
This site uses cookies.