Project Euler- get students coding to solve maths problems

Could your students code a simple program to solve this maths problem?

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Find the sum of all the multiples of 3 or 5 below 1000. is a website that proposes maths problems of varying difficulty which can be solved by developing simple computer programs. For example, here’s some Javascript code I wrote in to solve the first problem:

var n;
var total = 0;

for (n=1; n <= 999; n++ )
total = total + n;
total = total + n;
if(n%3 ===0 && n%5 ===0)
total = total – n;

The 550+ problems start relatively straight-forward, such as above and increase in difficulty as you move through them. You submit your solution to each question and it tells you that you are the nth person to solve it etc.

As coding is part of the National Curriculum these days, students should have the skills to access the problems in Project Euler.

A fun cross-curricular link? An extra-curricular maths club?

first seen


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s