Solving Project Euler

Project Euler, which is named after the mathematician Leonard Euler, is a collection of maths problems that are to be solved using computer programming.

This posts begins a series entitled “Solving Project Euler” which is my take on how to solve the questions.

While some problems can be solved by brute force methods, others require clever algorithms.

We begin with Problem 1.

The problem is fairly straight forward.
Find the sum of numbers that are less than 1000, which are multiples of 3 OR 5.

General Algorithm

    1. Initialize a variable to store the sum.
    2. Iterate through all the numbers from 1 to 999.
    3. If the remainder after dividing the numbers by either 3 or 5 is zero add it to the sum.

Solution in C++

Advertisements
Leave a comment

1 Comment

  1. Anonymous

     /  January 14, 2012

    I suppose you shouldn’t post the solutions. Its purely unethical.

    Reply

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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

%d bloggers like this: