Close

Challenge 1

A project log for Project Euler Challenges

Attempting a series of programming challenges from Project Euler.

jamie-ashtonJamie Ashton 7 days ago1 Comment

Challenge 1: 

'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.'

Simple solution in MATLAB:

Simple solution in C:

Both programs return the answer as 233,168.

Conclusion: A very simple first challenge, to ease me into things.

Discussions

Ken Yap wrote 7 days ago point

It would make it more interesting to eliminate the mod operation which is more costly than adds and subtracts on most machines.

  Are you sure? yes | no